I have a weird issue. I can get Event.COMPLETE to fire when I set
image.source = byteArray;
BUT
When I manipulate the byteArray – convert it to Bitmap and use image.source or image.load to load it, the bitmap gets loaded properly into the Image component; BUT Event.COMPLETE never fires. What might be wrong here? I have added an event lister for complete too! My source is as follows:
var bmp:Bitmap = scaleBitmapData(bitmapData,280,220);
imgPreview.addEventListener(Event.COMPLETE,onPreviewImageCompleted); // never fires
imgPreview.visible = false;
imgPreview.load(bmp); // does not work with .source either; image is displayed but Event.Complete never fires!
Thanks
Subrat
So the class in play here is SWFLoader (Image extends SWFLoader). If you passed in the ByteArray or a url than it adds the appropriate listener. What you’ve done is fed it a Bitmap, which is a display object. Here is the important code that is loading a Bitmap into an Image:
ByteArray:
a url:
So you get the gist here. Don’t convert it to a Bitmap and you’ll get your complete event. You could also add ADDED_TO_STAGE to your Bitmap.