I'm trying to load an image file that's right next to the .SWF file. Something like this:
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 output I get:
object
[Fault] exception, information=Error: Invalid source image.
The thing is loader.data has the image's bytes but is not a BitmapData instance and that's what Spritemap is expecting.
How to convert to BitmapData?
Thanks