Skip to main content
Inspiring
April 4, 2012
Question

Preload to Memory ( is that even possible ) ?

  • April 4, 2012
  • 2 replies
  • 3184 views

   So I noticed with the app I am working on.  There are some stutters the first time a section animates on the stage.  Once its been seen on the stage is performs great for the duration of the session.

     is there a way to preload all these movieclips to memory or something so that they will always perform great from the first time they are displayed to the stage ?

This topic has been closed for replies.

2 replies

April 4, 2012

The simple solution is to have a loading screen and simply place all your concent on the stage hiddent behind the loading screen image, then proceed to the level or animation you are loading, this way you get that first time on stage part out of the way in the background.

Applauz78Author
Inspiring
April 4, 2012

So Im trying that .. and it seems to work with MovieClips that are only 1 level.   However if its a movieclip that contains another movieclip in it... its not caching the 2nd level movie clip.

April 4, 2012

Put that second level movie clip to load on the stage as well.

April 4, 2012

I've found I sometimes experience less stutter if I have everything on the display list and control through visible rather than add/remove children.

Also you can try hiding through off screen x or y properties.

Applauz78Author
Inspiring
April 4, 2012

I always thought best practice is to removeChild and null movieclips when they arent needed for the moment. ?

WIth your method of visible and x y positioning.  ...   do you just do an addChild on everything when your app first starts and then position all elements to visible / false and/or off stage ?

then just toggle and set up as you need ?   

I have a feeling the same issue will happen where it will stutter the first time it is used. It's almost like the display has to actually see it one time through before it will remember it and play it smooth the next time.

Colin Holgate
Inspiring
April 4, 2012

It sounds like you're using GPU. When you do, the bitmap doesn't get transferred to the GPU until the first time it is within the stage area. If you smoothly animate it from outside of the stage, it will stutter as it goes into the stage area. You can solve that by placing it in the stage area for at least one frame's worth of time before you move it. It can be invisible at the time, it will still be cached. Then on the frame where you start to animate it, set it to be visible.