I am trying to upload an image file that is next to a .SWF file. Something like that:
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, function(e:Event):void {
trace(typeof(loader.data));
graphic = spritemap = new Spritemap(loader.data, 32, 32);
...
}
But this is the result that I get:
object
[Fault] exception, information=Error: Invalid source image.
The fact is that loader.data has image bytes, but is not an instance of BitmapData and what Spritemap expects.
How to convert to BitmapData?
thank
source
share