Jump to content


Cant get timelite max to work at all

Recommended Posts

I have a couple of animations that I need to append to each other in timeline lite on ENTER_FRAME and then I need to stop the animation sequence when a user clicks one of the buttons animating in the sequence.

Do I have my code correct? I can't get the timeline lite classes to work for me at all even in a quick test.


NOTE: I would be working on this in the timeline and not in a class file



addEventListener(Event.ENTER_FRAME, AnimateCircles)

function AnimateCircles(evt:Event):void


var john:TimelineLite = new TimelineLite();

timeline.append(TweenLite.to(b1, 2, {scaleX:1, scaleY:1, rotation:360});

timeline.append(TweenLite.to(b2, 2, {scaleX:1, scaleY:1, rotation:360});

timeline.append(TweenLite.to(b3, 2, {scaleX:1, scaleY:1, rotation:360});



Link to comment
Share on other sites

I doubt that you want to use ENTER_FRAME in that way.


assuming your framerate is 30fps, a new TimelineLite is being generated 30 times a second.


each new TimelineLite is competing with the one that was created 1/30th of a second ago so it never gets to run.




take all your TimelineLite code out of the animateCircles function and it should run fine, assuming you have imported the greensock classes properly.




one more thing. to format your code properly in a post, select it and hit the "code" button.




does that make sense? if not, please clarify why you are using ENTER_FRAME

Link to comment
Share on other sites

The reason I was trying to add that code to the enter_frame function is because I need this ad that I'm making to run a sequence of circle animations and when the user clicks on one then the animation will stop and animate on roll over only. Sorry if this msg is slightly convoluted. I'm writing from my phone in a car. Is there a better wAy to do this? Is there a way to chain some Tweens together and repeat them in the same way?

Link to comment
Share on other sites

yes, i believe a better way would be to tell your TimelineLite to have:


var john:TimelineLite = new TimelineLite({repeat:-1});


this will play the sequence over and over indefinitely.


re-creating the same timeline over and over again on ENTER_FRAME is not going to work well.

Link to comment
Share on other sites

var john:TimelineLite = new TimelineLite({repeat:-1});

Just a quick correction - TimelineLite doesn't have repeat capabilities built-in. Use TimelineMax for that. Same as TweenLite vs. TweenMax.


var john:TimelineMax = new TimelineMax ({repeat:-1});

Link to comment
Share on other sites

doh! Good catch GreenSock, Thanks much!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.