Jump to content
Search Community

trace the current position of my rotating gear

stephanberger4 test
Moderator Tag

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, 

 

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