SHARE
TWEET

Everybody Edits - Image

capasha Nov 7th, 2018 (edited) 159 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // EE SWF v789
  2.  
  3. //Script folder, States > PlayState.as
  4. //Listen to the connection message "images".
  5. this.connection.addMessageHandler("images",function(param1:Message):void
  6.          {
  7.             var _loc4_:String = null;
  8.             var _loc5_:int = 0;
  9.             var _loc6_:int = 0;
  10.             var _loc2_:Array = new Array();
  11.             var _loc3_:int = 0;
  12.             while(_loc3_ < param1.length)
  13.             {
  14.                _loc4_ = param1.getString(_loc3_); //Name of the image
  15.                _loc5_ = param1.getInt(_loc3_ + 1); //x position
  16.                _loc6_ = param1.getInt(_loc3_ + 2); //y position.
  17.                _loc2_.push(new ImageBlock(_loc4_,_loc5_,_loc6_)); //Push the data to ImageBlock
  18.                _loc3_ = _loc3_ + 3;
  19.             }
  20.             world.imageBlocks = _loc2_; //Add images array to World.as
  21.          });
  22.  
  23. //Script folder, ImageBlock.as
  24. private static function requestImage(param1:ImageBlock) : void
  25.       {
  26.          var item:ImageBlock = null;
  27.          var load:Loader = null;
  28.          var block:ImageBlock = param1;
  29.          for each(item in Global.cachedImages)
  30.          {
  31.             if(item.name == block.name)
  32.             {
  33.                block.handleLoaded(item.bmd);
  34.                return;
  35.             }
  36.          }
  37.          queryBlocks.push(block);
  38.          if(query.indexOf(block.name) != -1)
  39.          {
  40.             return;
  41.          }
  42.          query.push(block.name);
  43.  
  44.         //Load Image name
  45.          var imageLink:String = "https://r.playerio.com/r/everybody-edits-su9rn58o40itdbnw69plyw/Images/" + block.name + ".png";
  46.          load = new Loader();
  47.          load.load(new URLRequest(imageLink));
  48.          load.contentLoaderInfo.addEventListener("complete",function(param1:Event):void
  49.          {
  50.             var _loc5_:ImageBlock = null;
  51.             var _loc2_:BitmapData = new BitmapData(load.width,load.height,true,0);
  52.             _loc2_.draw(Bitmap(load.content));
  53.             var _loc3_:ImageBlock = new ImageBlock(block.name,0,0,false);
  54.             _loc3_.bmd = _loc2_;
  55.             Global.cachedImages.push(_loc3_);
  56.             query.removeAt(query.indexOf(block.name));
  57.             var _loc4_:int = queryBlocks.length - 1;
  58.             while(_loc4_ >= 0)
  59.             {
  60.                _loc5_ = queryBlocks[_loc4_];
  61.                if(_loc5_.name == block.name)
  62.                {
  63.                   _loc5_.handleLoaded(_loc2_);
  64.                   queryBlocks.removeAt(queryBlocks.indexOf(_loc5_));
  65.                }
  66.                _loc4_--;
  67.             }
  68.          });
  69.       }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top