stephanberger4

trace the current position of my rotating gear

Recommended Posts

Hi, 

 

I've got a gear that rotates each time I click on it :

 

gear1.addEventListener(MouseEvent.CLICK, turn_gear1, false, 0, true);



function turn_gear1(event:MouseEvent):void{

TweenLite.to(gear1, 1, { rotation: "+=10", ease: Linear.easeNone });

}

 

Is there a way to trace the current position of the gear each time it has finish the rotation ? Cause I would like to trigger a function when the gear is in a specific position.

 

Thanks for your help, 

 

Share this post


Link to post
Share on other sites

sounds like you could use an onComplete callback like

function turn_gear1(event:MouseEvent):void{

TweenLite.to(gear1, 1, { rotation: "+=10", ease: Linear.easeNone, onComplete:getRotation});

}



function getRotation() {

trace(gear1.rotation);

}

 

  • Like 1

Share this post


Link to post
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.