# You're not listening to me!

**URL:** <https://forum.kirupa.com/t/youre-not-listening-to-me/300243>\
**Category:** flash\
**Created:** [November 18, 2009, 3:53am UTC](https://forum.kirupa.com/t/youre-not-listening-to-me/300243 "2009-11-18T03:53:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![letter](https://avatars.discourse-cdn.com/v4/letter/l/c89c15/32.png) [@letter](https://forum.kirupa.com/u/letter)\
**Post date:** [November 18, 2009, 3:53am UTC](https://forum.kirupa.com/t/youre-not-listening-to-me/300243/1 "2009-11-18T03:53:14Z")

</div>

Take a BIG user submited image: say 2848x2136 pixels (I said it was big) and resize it with a Matrix:

```auto

[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]
