AS2: Wait for actionscript to run before loading frame
I have a script that takes lots of content and bu开发者_C百科ilds 1000s of MovieClips on the stage, does lots of drawing etc. Due to the high amount of work needed when the frame first loads this can sometimes be delayed by a second or two.
The more the user uses the application the longer and longer this is likely to be (more data to siphon through and build).
My question to you is how do I make sure the frame doesn't show (serve a loading image or something) until it is built? I don't want the user to see the skeleton of the page and then everything appear a second or two later.
The way we do it:
Frame 1 is a loading frame. It simply continually polls progress (onEnterFrame) until it is sufficiently "complete" to move on to the frame that is needed. In your case, it might be that you're testing to see if you've instantiated enough objects, in our case it was whether framesloaded was sufficiently high.
We often put a "loading graphic" in frame 1. Other than that we have the "am I ready to finally move on yet?". Most recently our loader just had a circle which continued rotating.
As a side note: wait until everything is completely ready if you're working with an AS3 loader. Loading half-cocked left me working until 3 AM on Easter one year. I was not happy.
精彩评论