Search code examples
actionscript-3flashaddchilddisplayobject

addChild(): How can I know when a DisplayObject is actually displayed on the stage?


I've got a large (4096x4096) image loaded into memory, but when I try to use addChild, there is a long delay before it actually gets drawn to the screen. This is expected. However, is there an event I can listen for to know the moment that the DisplayObject (a .png image) is actually drawn to the screen?

I am trying to load the images onto the screen, then do something after they are actually drawn.


Solution

  • The delay is due to Flash Player decompressing the image in preparation for rendering.

    The trick is to force Flash Player to decompress before you need it - then it will 'instantly' appear on the stage.

    I can't take any credit for idea - but i'll take the bounty ;). Here's the article that enlightened me and explains it fully: http://jacksondunstan.com/articles/2080