Take a BIG user submited image: say 2848x2136 pixels (I said it was big) and resize it with a Matrix:
[LEFT]private static function resizeBitmapData(bmpSource:BitmapData, setWidth:Number, setHeight:Number):BitmapData {
var scaleWidth:Number=setWidth/bmpSource.width;
var scaleHeight:Number=setHeight/bmpSource.height;
var bmp:BitmapData=new BitmapData(setWidth,setHeight,true,0);
var matrix:Matrix = new Matrix ();
matrix.scale(scaleWidth, scaleHeight);
bmp.draw(bmpSource, matrix);
return bmp;[/LEFT]
}
[LEFT]And then add the bitmap to the stage on the next line… throws the error “can’t access a property of a null… blah blah blah”[/LEFT]
[LEFT]I get it, it’s taking a while for flash to resize my gigantamus image, that’s fine and understandable.[/LEFT]
[LEFT]Finally to my question: How do I set up a listener (or something else) to make sure the image is actually resized. [/LEFT]
[LEFT]I tried firing a method inside my resizer right before the bmp is returned, but that didn’t seem to work. Only thing that works is a manual timer to slow things down a bit and that’s just messy. [/LEFT]
[LEFT]I guess I’m wishing for a bm.draw(bmd).addEventListener(GRAPHICSEVENT.complete, doneResizing); or something crazy like that. But I can find no such event in the package. [/LEFT]
[LEFT]Other ideas for making sure flash is done with bitmap data before adding it to the display list? [/LEFT]