Return to Snippet

Revision: 48079
at June 23, 2011 07:24 by Heol


Initial Code
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.Event;
import flash.display.BitmapData;
 
var loader:Loader = new Loader();
loader.loadBytes(byteArray);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
 
private function loaderComplete(event:Event):void
{
    var loaderInfo:LoaderInfo = LoaderInfo(event.target);
    var bitmapData:BitmapData = new BitmapData(loaderInfo.width, loaderInfo.height, false, 0xFFFFFF);
    bitmapData.draw(loaderInfo.loader);
    // result: bitmapData
}

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

Initial Description

                                

Initial Title
ByteArray to BitmapData

Initial Tags

                                

Initial Language
ActionScript 3