Return to Snippet

Revision: 48077
at June 23, 2011 07:21 by Heol


Initial Code
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.Event;
import flash.net.URLRequest;
import flash.utils.ByteArray;
 
var loader:Loader = new Loader();
loader.load(new URLRequest("banner1.jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
 
private function loaderComplete(event:Event):void
{
    var loaderInfo:LoaderInfo = LoaderInfo(event.target);
    var byteArray:ByteArray = loaderInfo.bytes;
    // result: byteArray
}

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

Initial Description

                                

Initial Title
Image (Loader) to ByteArray

Initial Tags

                                

Initial Language
ActionScript 3