Search code examples
actionscript-3texturesstarling-framework

When Object is loaded into memory?


How can I check when this operation:

Page2 = Texture.fromBitmap(new Page2Class(), true, true, FactorScaler);

is complete (process finished, Page2 ready to use on stage) and I'm ready for loading next Page3 object and so on?

Now I use timer with static time being set. But it's not optimal, I wait too much sometimes and too short other time. I need to know exact time.

This should run in Starling Framework on Android and iOS.

Ps.: If I don't wait the app will crash due to too heavy pipeline.


Solution

  • The answer was given by Jeff on Starling forum: http://forum.starling-framework.org/topic/when-texture-object-is-loaded

    Information about Texture being fully loaded is dispatched from Texture.fromAtfData method's 4th parameter (function). So to use it your asset needs to be of ATF format.