blase Posted December 13, 2009 Share Posted December 13, 2009 so, i have done this: import gs.OverwriteManager; OverwriteManager.init(); and i have one object and 2 possible tweens affecting it, one moving it in one direction, other reversing it. the code doesnt really mater, the important thing is that its affecting the same object. function showTextInfo():void { TweenLite.to(activeSong_mc, _switchTextInfoTime, { y: _infoDownY, onComplete: startTextInfoTimer, overwrite: 0 }); } function hideTextInfo():void { TweenLite.to(activeSong_mc, _switchTextInfoTime, { y: _infoUpY, onComplete: afterCloseInfoHandler, overwrite: 0 }); } i have some nasty bug in my code and i dont know if this is normal or what... does having OverwriteManager to NONE means that each tween will finish before going to the next one? the problem is that sometimes (i am still having hard time to figure out when exactly), when i am constantly calling these same tweens, the tween like skippes quickly to the next one (or sometimes even looks like it was never there...), although it should be lasting the predefined time.... Link to comment Share on other sites More sharing options...
GreenSock Posted December 13, 2009 Share Posted December 13, 2009 When you set overwrite to 0 (or false), you're telling it NOT to look for any overlapping tweens to kill - it will allow multiple tweens of the same object to exist which can lead to exactly the problem you're describing. Imagine you start tweening mc.x to 100 over the course of 1 second, but then you immediately start another tween of mc.x to 0 over the course of 0.5 seconds. Both tweens would fight for the first 0.5 seconds (with the 2nd one winning) and then when the 2nd one finishes, the first one is still going so it would suddenly jump to halfway done with the first tween to 100. The moral of the story: be very careful when setting overwrite to 0. You're taking full responsibility of managing your tweens in that case. It's usually much better to either use the AUTO mode (2) or the ALL_IMMEDIATE mode (1). If you don't have any other tweens affecting other properties of the object, I'd recommend using overwrite:1 because it's faster than AUTO. It's perfect for button rollover/outs. But AUTO is extremely convenient. Why did you set overwrite:0 in the first place? Is there a reason you didn't just leave it in the default AUTO mode? Link to comment Share on other sites More sharing options...
blase Posted December 13, 2009 Author Share Posted December 13, 2009 i dont really know i wanted to execute all tweens to the end, although dont know if this is possible... if one tween is lasting, and another one gets called on the same object i wanted it to complete previous tween and then continue with the next one... this would be like tween queue Link to comment Share on other sites More sharing options...
GreenSock Posted December 14, 2009 Share Posted December 14, 2009 If you want to set up a queue, you could use a TimelineLite like: var queue:TimelineLite = new TimelineLite({onComplete:clearQueue}); function rollOver(event:MouseEvent):void { if (queue == null) { queue = new TimelineLite(); } queue.append( new TweenLite(mc, 1, {alpha:1}) ); } function rollOut(event:MouseEvent):void { if (queue == null) { queue = new TimelineLite(); } queue.append( new TweenLite(mc, 1, {alpha:0}) ); } function clearQueue():void { queue = null; } That way, the tweens would always get added to the queue if one is in progress. That was just one idea off the top of my head, but there are probably other ways too. Learn about TimelineLite at http://blog.greensock.com/timeline-basics/ 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