cerulean Posted May 30, 2013 Share Posted May 30, 2013 This is almost certainly a bug in my code, but I'm moving some elements forward in z-space (that is low to high z) using TweenMax's in a TimelineMax // pseudo code TLM:TimelineMax = new TimelineMax; for (var i:int = 0; i< someNumber; i++) { var tw:TweenMax = new TweenMax(anAsset,TWEEN_TIME,{onUpdate:doUpdate,onUpdateParams:["{self}"],z:someFinalZ}); TLM.add(tw,TWEEN_Time/i); } private function doUpdate($tw:TweenMax):void { sortElementsOnZPosition(); // sort all the elements display position based on z, using addChild() if (something) { $tw.timeScale(0.5); // slow down } else { $tw.timeScale(1); // set back to normal } } Sometimes I want to slow down the tweened elements' z-motion (and in a separate call I'm moving them on x axis), but when I want to set the tween back to normal speed, they suddenly jump forward in z-space, as if they were suddenly set back to where they'd been if they'd never been slowed. There's a lot going on behind the scenes, including addChild()-ing the elements (based on a z-sort), etc. Surely something in my code, but the tweens are pretty separate from everything else, so I'm wondering if there's something related to timeScale of Tweens in a Timeline that I'm missing. Thanks! Link to comment Share on other sites More sharing options...
Carl Posted May 31, 2013 Share Posted May 31, 2013 Try setting smoothChildTiming:true in the timeline's constructor like so var TLM:TimelineMax = new TimelineMax({smoothChildTimiing:true}); I'm pretty sure that will help. I can't explain it any better than the docs: http://api.greensock.com/as/com/greensock/TimelineMax.html (see special properties) 1 Link to comment Share on other sites More sharing options...
cerulean Posted May 31, 2013 Author Share Posted May 31, 2013 Thanks. That did solve it. But it introduced other weirdness — this was the timeline which you helped me with before, where the tweens are spread out and then restarted as each one comes to completion — I think there's probably an issue with that technique when smoothChildTiming is true. They're OK with this game for the moment without the timeScale so I'll investigate later… As a sidenote, has anyone done a graphic of how TimelineMax works with childSmooth: true? In my head, from the API docs, I'm picturing it like the Flash IDE timeline, where one is flipping and moving the child tweens…I suppose it's exactly like that. Link to comment Share on other sites More sharing options...
Carl Posted June 3, 2013 Share Posted June 3, 2013 Hi, no we haven't done a graphic for smoothChildTiming, but yes if you were to take a classic tween in the Flash IDE and literally flip it around the playhead, that is exactly what happens. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now