Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
3Eyes

Clicking the mouse to change the tween duration?

Recommended Posts

Hi,

 

I'm a bit new to AS3 and have a simple question to ask.

 

I'm making a card game and use TweenLite to animate the cards coming off the deck. I would like the user to have the option of speeding up the animation though. Is there any way I can make it so that while my tween is moving the card, and the user clicks the mouse anywhere on the screen, it changes its duration to a shorter time (deals the card faster, during the tween)?

 

Any help is much appreciated!

Link to comment
Share on other sites

Sure, TweenMax, TimelineLite, and TimelineMax all have a timeScale property that you can set anytime, even while the tween is in progress. Heck, you can even tween that property with another tween! Setting timeScale to 0.5 would make it run at half speed while 2 would make it run twice as fast. Feel free to tuck a bunch of tweens into a TimelineLite and then alter its timeScale to affect all of those tweens as a whole.

Link to comment
Share on other sites

Sure, TweenMax, TimelineLite, and TimelineMax all have a timeScale property that you can set anytime, even while the tween is in progress. Heck, you can even tween that property with another tween! Setting timeScale to 0.5 would make it run at half speed while 2 would make it run twice as fast. Feel free to tuck a bunch of tweens into a TimelineLite and then alter its timeScale to affect all of those tweens as a whole.

 

I apologize because I know this has nothing to do with TweenMax, but how would I set up an event listener to do this? I know how to set one up to listen for a click on abutton or movieclip, but not anywhere on the screen.

 

Thank you!

Link to comment
Share on other sites

you can add your listener to the stage, ala:

 

stage.addEventListener(MouseEvent.MOUSE_UP, myHandler);

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