Share Posted July 15, 2010 Hi there, I ran into a certain problem. I try to switch different products and need them to animate. The whole content is dynamic from XML. So i first created in a for loop multiple tweens with var myTween:TweenMax Runs perferct. I have control over all "myTween". But i need it to run with TimeLineMax. So I tried var myTL:TimelineMax But "myTL" seems to be overwritten. Here's the code to clarify: for(var i:int = 0; i < fileArr.length; i++) { this.addChild(new MovieClip()).name = "mc"+i; var myTL:TimelineMax = new TimelineMax(); myTL.append(TweenMax.to(..tweening code here...); myTL.append(TweenMax.to(..tweening code here...); myTL.append(TweenMax.to(..tweening code here...); } So I'd need something like myTL1, myTL2, myTL3 and so on, but I don't know how. I also tried to store each "myTL" in an array... same effect. So... anybody has an idea how to dynamically naming new Timeline Instances within a for loop? Andy Link to comment Share on other sites More sharing options...
Share Posted July 15, 2010 I'd definitely recommend storing them in an array - it's pretty messy to just create a bunch of variables like myTL1, myTL2, etc. var timelines:Array = []; for(var i:int = 0; i this.addChild(new MovieClip()).name = "mc"+i; var myTL:TimelineMax = new TimelineMax(); myTL.append(TweenMax.to(..tweening code here...); myTL.append(TweenMax.to(..tweening code here...); myTL.append(TweenMax.to(..tweening code here...); timelines.push(myTL); } Then you'll have a "timelines" array with all your instances. 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