Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
tlpann

Force tween reverse then start it again

Recommended Posts

Hello,

 

I'm new to this forum. I apologize in advance if this question has been answered -- I'm brand new to TweenMax and (perhaps unwisely) trying to use it in a project that needs to be done very soon.

 

I am using TweenMax to make a message box appear with contextual information. Certain user actions cause the message box's text to change, then the box appears, remains for 3 seconds, then disappears. My limited knowledge of TweenMax enables me to do this (code is simplified):

// mouse over buttons and get two different messages
msgBox.addMessage("This button is disabled.");                      // message 1
msgBox.addMessage("Click this button to open the control panel.");  // message 2

function addMessage(msg:String):void {
     box.text = msg;
     myTween = TweenMax.to(box, 0.3, {alpha:1});
     TweenMax.delayedCall(3, startReverse);
}
function startReverse():void {
     myTween.reverse();
}

This works nicely until the next bit of functionality comes into play: Say the user mouses over button 1, then quickly mouses over button 2 while the message for button 1 is still visible. I want to interrupt the delayed call, make message 1 fade immediately, and then call addMessage for message 2.

 

Is/are there TweenMax methods that enable a graceful and simple way to do this?

 

Thank you,

Tim

 

Link to comment
Share on other sites

Hi,

 

You can kill the the delayedCall using 

TweenMax.killTweensOf(startReverse);

http://greensock.com/asdocs/com/greensock/TweenMax.html#killChildTweensOf()

 

I think doing that at the same time as myTween.reverse() should do what you want.

 

If you need more help, please post a very simple fla (zipped) and we will take a peak.

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