Jump to content
Search Community

TimelineLite clear onComplete?

tikiri test
Moderator Tag

Recommended Posts

Hey,

I've got troubles with my timeline. I inserted some tweenlites on it and I need to delete the last one.

 

 

timeline.insert(TweenLite.to(redPanel, 0.5, { width:260, x: -365} ));

timeline.insert(TweenLite.to(blackPanel, 0.5, { width:470, x: 0 } ));

timeline.insert(TweenLite.to(whitePanel, 0.5, { width:260, x: 365 } ));

timeline.insert(TweenLite.to(redPanelTitle, 0.5, { x: -380, alpha:0 } ));

timeline.insert(TweenLite.to(redPanelText, 0.5, { x: -450, alpha:0 } ));

timeline.insert(TweenLite.to(blackPanelTitle, 0.5, { x: -90, alpha:0 } ));

timeline.insert(TweenLite.to(blackPanelText, 0.5, { x: -190, alpha:0 } ));

timeline.insert(TweenLite.to(whitePanelTitle, 0.5, { x: 330, alpha:0 } ));

timeline.insert(TweenLite.to(whitePanelText, 0.5, { x: 280, alpha:0 } ));

timeline.insert(TweenLite.to(blackPanel, 0.5, { y : 100, scaleY: 0.6, delay: 0.5 } ));

 

I need to reverse it back and then clear the timeline, but when I use this

 

timeline.reverse();

timeline.clear();

 

the clear is done in the same time as reverse, so reverse is not done.

 

How to do that? Thanks for answers :) I

Link to comment
Share on other sites

Hi tikiri,

There are a few ways you could do this, but the best one I know of is to use the onReverseComplete property when you instantiate your timeline:

 

var timeline:TimelineLite = new TimelineLite({onReverseComplete:timeline.clear});

 

Have a look at the timelinelite Documentation for an explanation: http://www.greensock.com/as/docs/tween/

 

Let us know how you get on and post back if you have any other questions!

 

X10

Link to comment
Share on other sites

GREAT! :) It works perfectly, u absolutely solved my problem, thank u very much!!

 

The only exception is that I wasn't able to call the method timeline.clear() in the constructor of the timeline. I had to call a method clearTimeline()

which contains the method timeline.clear()

 

public var timeline:TimelineLite = new TimelineLite({onReverseComplete:clearTimeline});

 

private function clearTimeine():void

{

timeline.clear();

}

 

Is there any reason that came to your mind, why doens't it work the way u wrote first?

 

Thanks in advance

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...