Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Put that second level movie clip to load on the stage as well.
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
The second level movieclip is on the stage.
To test..
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,
Copy link to clipboard
Copied
Love me some TweenMax, TweenLite. Anyhow you can then pretween your content before you show it to the user, do an accelerated tween so in like .1 seconds.
Copy link to clipboard
Copied
Mark . can you elaborate on this ?
How do you pre tween with tweenMax ?
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Mark,
No go .. this didnt have any influence at all
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
What is the movie clip in question, is it just a still graphic or is it a timeline animation, or are you tweening children inside the parent mc from the stage?
Copy link to clipboard
Copied
Right now its just a movieclip and on the stage of that movieclip is 15 movieclip icons.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Try preloading those 15 mcs separately on the preload hidden screen, just for my own amusement.
Also try it without addChild but just plop those movie clips down on the timeline.
Copy link to clipboard
Copied
Gonna try putting the movieclips right on the timeline and controlling them from there with visible true / false now ... will report the results.
Copy link to clipboard
Copied
WOW! ... adding the movieclip directly to the timeline makes it a lot worse!
Copy link to clipboard
Copied
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.