Jump to content
Search Community

A problem about reversing a timeline

ringo1988 test
Moderator Tag

Recommended Posts

That's the code...

var btn1TL:TimelineLite = new TimelineLite({paused:true});
btn1TL.appendMultiple([new TweenLite(btn1, 1, {alpha:0.5}),
			   new TweenLite(btn1, 0.5, {x:"+100"})],
			   0, TweenAlign.SEQUENCE, 0);

var buttonOffset:TimelineLite = new TimelineLite({paused:true});
buttonOffset.appendMultiple([new TweenLite(modelling, 0.3, {y:"-100"}),
				    new TweenLite(btn1, 0.3, {y:"-100"}),
				    new TweenLite(btn2, 0.3, {y:"-100"}),
				    new TweenLite(btn3, 0.3, {y:"100"}),
				    new TweenLite(btn4, 0.3, {y:"100", onComplete:PageStart})],
				    0, TweenAlign.START, 0);
function PageStart():void
{
btn1.mouseEnabled = false;
Page1TL.play();
}

btn1.addEventlistener(MouseEvent.MOUSE_DOWN, btn1Down);
function btn1Down(e:MouseEvent):void
{
buttonOffset.play();
}

btn2.addEventlistener(MouseEvent.MOUSE_DOWN, btn2Down);
function btn2Down(e:MouseEvent):void
{
buttonOffset.reverse();
}

The problem is after clicking "btn2", it only reverses the timeline "Page1TL" but not both the timeline(buttonOffset and then Page1TL).

Sorry for my poor English and hope someone can help me to solve the problem. Thanks

Link to comment
Share on other sites

You didn't show your code for Page1TL. And your btn2 listener only calls reverse() on buttonOffset. Did you mean to also call reverse() on btn1TL? Also watch out for conflicting tweens - I noticed that you're tweening btn1 in BOTH buttonOffset AND btn1TL. If you play them both at once, one will overwrite the other.

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