Jump to content
Search Community

Thanks and Quick Question

alaricoffir test
Moderator Tag

Recommended Posts

First of all, I'd like to tell the person responsible for these packages (TimeLineLite/Max, TweenLite/Max, etc.) that this is truly AWESOME! Such complete and amazing code! Thank you!

 

Quick question: In the code below, the function 'complete' gets called right away, even though the time line has just being created and is still empty. I looked in the documentation but didn't see why the onComplete event is triggered right away. Adding 'tl.kill();' right after declaring the TimeLineMax variable prevents the 'complete' function from being called, but I am not sure what the method 'kill' is stopping for there's nothing in the time line yet. Does anybody know the answer?

 

import com.greensock.TimelineMax;

 

var tl:TimelineMax = new TimelineMax({onComplete:complete});

 

function complete():void {

trace('completed');

}

Link to comment
Share on other sites

Hey Alaricoffir,

 

TimelineMax instances start playing immediately. Since you tl instance has nothing in it is completes instantly.

 

try this

 

import com.greensock.TimelineMax;

 

var tl:TimelineMax = new TimelineMax({onComplete:complete, paused:true});

tl.insert(new TweenLite(movieClipInstanceName, 2, {alpha:0}));

 

tl.play();

 

 

 

function complete():void {

trace('completed');

}

 

note the paused:true in the constructor. this tells the timeline not to play instantly.

also note the addition on tweenlite instance and the tl.play() method... that gets it going.

 

once you experiment with timelinemax a bit you will be in love.

 

Carl

Link to comment
Share on other sites

Thank you the reply Carl!

 

I am guessing the creator wanted to be consistent with Flash's time line behavior where, unless you have a "stop" method call in the first frame, the movie just plays.

 

I am in love already. I am even thinking about becoming a "Shockingly Green" member today.

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.
×
×
  • Create New...