Share Posted March 24, 2014 Hey guys. This is my first foray into TimelineMax. I'm trying to build an app that will take the same timeline and repopulate with another clip before it plays again. So far, the only way I've been able to make it work throws errors. Any advice? var elements:Array = new Array(mc0,mc1,mc2) var counter:Number = 0; var tl:TimelineMax = new TimelineMax({paused:true, repeat:0});; var mc = elements[counter]; function stopIt():void { tl.pause(); } stage.addEventListener(MouseEvent.CLICK, resume) function resume(e):void { tl.resume(); tl.to(mc, 1, {x:100, onComplete:stopIt}); tl.to(mc, 1, {x:300, onComplete:stopIt}); tl.to(mc, 1, {y:250, onComplete:stopIt}); counter = counter+1; mc = elements[counter] } Link to comment Share on other sites More sharing options...
Share Posted March 25, 2014 I wouldn't recommend trying to change the target of a tween. The target property is read-only and not meant to be changed once a tween has been constructed. One thing you could do is swap children of the target. So if your tween is tweening mc, perhaps you can run a function that removes a child from mc and then adds a new one. In cases like this I would normally suggest that each time you need a new target you run a function that calls clear() on your timeline and you rebuild it with new tweens with new targets. Link to comment Share on other sites More sharing options...
Author Share Posted March 25, 2014 Got it. Thanks, Carl. 1 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