SHARE
TWEET

Untitled

a guest Jun 3rd, 2019 197 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function getCachedImage(sku:String) : BitmapData
  2.       {
  3.          var numObjects:int = 0;
  4.          var flashVar:Object = null;
  5.          var regExp:RegExp = null;
  6.          var startIndex:int = 0;
  7.          var loader:Loader = null;
  8.          var req:URLRequest = null;
  9.          var context:LoaderContext = null;
  10.          var i:int = 0;
  11.          if(sku == null || sku == "")
  12.          {
  13.             return this.getDefaultPicture();
  14.          }
  15.          var bmp:BitmapData = this.mCachedObjects[sku];
  16.          var uses:int = this.mUses[sku];
  17.          var length:int = 0;
  18.          if(this.mKeys == null)
  19.          {
  20.             length = this.mKeys.length;
  21.          }
  22.          if(bmp == null)
  23.          {
  24.             for each(bmp in this.mCachedObjects)
  25.             {
  26.                numObjects++;
  27.             }
  28.             if(numObjects == MAX_IMAGES)
  29.             {
  30.                for(i = 0; i < length; i++)
  31.                {
  32.                   if(this.mUses[this.mKeys[i]] == 0)
  33.                   {
  34.                      delete this.mUses[this.mKeys[i]];
  35.                      BitmapData(this.mCachedObjects[this.mKeys[i]]).dispose();
  36.                      delete this.mCachedObjects[this.mKeys[i]];
  37.                      this.mKeys.splice(i,1);
  38.                      break;
  39.                   }
  40.                }
  41.             }
  42.             flashVar = Star.getFlashVars();
  43.             Security.loadPolicyFile("http://api.gamatar.org/crossdomain.xml");
  44.             Security.loadPolicyFile("http://www.gamatar.org/crossdomain.xml");
  45.             Security.loadPolicyFile("http://www8.gamatar.org/crossdomain.xml");
  46.             Security.loadPolicyFile("http://profile.ak.fbcdn.net/crossdomain.xml");
  47.             Security.loadPolicyFile("http://cdn1.kongregate.com/crossdomain.xml");
  48.             Security.loadPolicyFile("http://cdn2.kongregate.com/crossdomain.xml");
  49.             Security.loadPolicyFile("http://cdn3.kongregate.com/crossdomain.xml");
  50.             Security.loadPolicyFile("http://cdn4.kongregate.com/crossdomain.xml");
  51.             Security.loadPolicyFile("http://api.kongregate.com/crossdomain.xml");
  52.             Security.loadPolicyFile("http://l.yimg.com/crossdomain.xml");
  53.             Security.loadPolicyFile("http://socialprofiles.zenfs.com/crossdomain.xml");
  54.             Security.loadPolicyFile("http://avatars.zenfs.com/crossdomain.xml");
  55.             regExp = /cdn.*.kongregate/i;
  56.             startIndex = sku.search(regExp);
  57.             if(startIndex > -1)
  58.             {
  59.                sku = sku.replace(regExp,"api.kongregate");
  60.             }
  61.             loader = new Loader();
  62.             req = new URLRequest(sku);
  63.             context = new LoaderContext(true);
  64.             if(Security.sandboxType == Security.REMOTE)
  65.             {
  66.                context.securityDomain = SecurityDomain.currentDomain;
  67.             }
  68.             context.checkPolicyFile = true;
  69.             loader.name = sku;
  70.             loader.contentLoaderInfo.addEventListener(Event.COMPLETE,this.onComplete);
  71.             loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,this.onError);
  72.             loader.load(req,context);
  73.             bmp = new BitmapData(IMAGE_SIZE,IMAGE_SIZE);
  74.             bmp.draw(this.getDefaultPicture());
  75.             this.mCachedObjects[loader.name] = bmp;
  76.          }
  77.          uses++;
  78.          this.mUses[sku] = uses;
  79.          return bmp;
  80.       }
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