I need to load the bytecodes of the image into a String
and then convert it to Bitmap
. I am using the code below but without success:
var urlLoader:URLLoader = new URLLoader();
urlLoader.load(new URLRequest("imagebytecode.txt"));
urlLoader.addEventListener(Event.COMPLETE, loaded);
function loaded(e:Event):void {
var str:String = urlLoader.data;
var byteArray:ByteArray = new ByteArray();
byteArray.writeUTFBytes(str);
var bitData:BitmapData = new BitmapData(100, 100);
var rec:Rectangle = new Rectangle(0, 0, 100, 100);
bitData.setPixels(rec, byteArray);
var bit:Bitmap = Bitmap(bitData);
}
How much do I encode the image to Base64
and open it using the Steve Webster library, works correctly.