Posted By

Heol on 06/23/11


Tagged

ByteArray


Versions (?)

Image (Loader) to ByteArray


 / Published in: ActionScript 3
 

URL: http://blog.yoz.sk/2009/10/bitmap-bitmapdata-bytearray/

  1. import flash.display.Loader;
  2. import flash.display.LoaderInfo;
  3. import flash.events.Event;
  4. import flash.net.URLRequest;
  5. import flash.utils.ByteArray;
  6.  
  7. var loader:Loader = new Loader();
  8. loader.load(new URLRequest("banner1.jpg"));
  9. loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
  10.  
  11. private function loaderComplete(event:Event):void
  12. {
  13.     var loaderInfo:LoaderInfo = LoaderInfo(event.target);
  14.     var byteArray:ByteArray = loaderInfo.bytes;
  15.     // result: byteArray
  16. }

Report this snippet  

You need to login to post a comment.