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 ?
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.
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.
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.
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.
Of course that will be the case. You would need the sub movieclip to be in the stage area of the movieclip. You're only just getting a hint of why I like Direct more than GPU, if Direct ends up being good enough!
The second level movieclip is on the stage.
I left visible to true .. so I can verfiy everything is on the stage ... then I do the initial tweenMax from the off the stage back onto the stage. .. The first time this happens.. .it skips. Every time after that .. its fine,
Oh I sounded over complicated on my post, I am still in that whole hide your content you want to load in the background mode, then tween it it while its hidden once, just an accelerated version of it, then when you tween it for the user it will be pre tweened.
This is kind of a hacky way of doing it, but if it works and solves your issue then who cares, right?
ahh ... tween it while hidden ... You had me excited for a minute.. thought maybe greensock had a method of pre caching the movieclip its going to tween to the GPU. Gonna try your method now. Will report the results.
So it still stutters when you tween it the second time? Seems strange since you said after you tween it once the second time around it runs smooth, so the hidden tween would be the tweening it once and the visible tween would be the smooth tween.Did you tween it the first time while its set to visible = false? If so do it with it being visible, although hidden, you know what I mean.
The visibility won't affect whether it's cached. Whether it's inside the stage area does. Having the same symbol cached at a different position in the hierarchy doesn't mean that other cases where the symbol is used is also cached.
no no ..
So whats happening is that it stutters on the first real visible tween.
I even tried using loadChild when the app first loads.. but set an index of 0 to hide it.
then when you click the button to view that movieclip .. I moved the index up to bring the clip to the front and do the tween .. That still stutters.
I tried putting the tween while the movieclip is at 0 .. even tried using the exact tween statement of the actual tween I perform while visible. ... It still stutters.
Once the stutter happens once.. it never happens again until you close the app completely. and re open.
And then you are tweening those 15 movie clips from the main stage?
And from previous post it sounds like you have tried putting those 15 mcs in the preloading hidden screen? correct?
From my experience flash seems to have a bit of a delay playing sounds or movie clips or anything the first time it encounters it however playing it once before seems to solve this problem, not sure why any of my pro tips are not helping
Lets call my main movieclip MainMovie_mc
inside of MainMovie_mc is 15 movieclips they are all on the stage already.
On the hidden preload I am only doing the addChild from the library for MainMovie_mc .. as it contains all the other smaller movieClip icons.
When Im doing the hidden tween I am only doing that tween on MainMovie_mc
There is a big delay between adding child and when I do the tween. THe tween is invoked by a button press.. so I have lots of time to wait before I push the button to do the real tween.
I do the hidden tween immedately when the addChild is performed.
Now I am totally confused. You tried taking out the 15mcs from the parent and putting them on the timeline? I was suggesting just duplicating them on the timeline as their own entities and still keeping them in the parent mc, I am guessing you put them all in one mc for a reason. Also how does your loading screen work? Are you pausing on it for a second or two or do you just let the movie play through that frame? You might need to stop there for a few seconds to allow flash to load up all the assets.