After reading some previous posts, it appears that the best way to
convert a byte array into a Bitmap is though the loader class...
loader.loadBytes(myByteArray);
Thus, I created a simple test to see if I could get it to work.
private function myTest():void{
//get ByteArray from Image Component content
var testBM:Bitmap = testImg.content as Bitmap;
var myByte:ByteArray = new
JPEGEncoder().encode(testBM.bitmapData);
//convert ByteArray to Bitmap
var ldr:Loader = new Loader();
ldr.loadBytes(myByte);
//reset source
myImage.source = ldr.content;
}
In my debugging it fails silently, but I get the follow message when
I try to look into the vars (Error: Error #2099: The loading object
is not sufficiently loaded to provide this information.) Also the
"content" property is "null" even though the bytes are fully loaded.
Is there another better way to do this. I have been struggling with
this all day.
Thanks, Kevin