Jump to content
GreenSock

Alex.A

"hasTween" listener

Recommended Posts

Hi!

 

Is there a way to check if mc has already started tween or not?

import com.greensock.*;
import com.greensock.easing.*;


addEventListener(Event.ENTER_FRAME, updater);

function updater(e:Event) {
	var collision:Boolean = CDetector.checkCollision();
	if (collision) {
		TweenLite.to(mc, 2, {alpha:0});
	} else {
		TweenLite.to(mc, 2, {alpha:1});
	}
}

Tween in enterFrame is not good for CPU I think ;)

Link to comment
Share on other sites

I think TweenMax.isTweening() is what you want.

 

To test if mc is being tweened do

if (TweenMax.isTweening(mc) ) {
  // if true do this
} else {
  // if false do this
}
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.
×