Skip to main content
maidenskull
Participant
November 29, 2016
Answered

stopping a rotate continuously command

  • November 29, 2016
  • 1 reply
  • 374 views

Hi there!

I'm pretty much brand new to animate, and have finished a few simple animations. I'm currently working on an interactive animation of a turntable. Essentially as buttons are clicked, the machine comes on, the tone arm moves over and the record begins to spin. It was created as Action 3. And I'm now trying to code it, using the actions and code snippets within the program. The record is spinning via a rotate continuously code snippet which begins after a button is pressed, but I cannot seem to find a way to stop the rotation when another button is pushed, though I'm convinced there has to be a way. any

Any advice anyone had here would be greatly appreciated, thanks!

This topic has been closed for replies.
Correct answer Colin Holgate

If you look at the code snippet it has a line like this ('turntable' is the name I gave the movieclip, your name is most likely different):

turntable.addEventListener(Event.ENTER_FRAME, fl_RotateContinuously);

If you have made that work with a button click, it's going to be something like:

function startturning(e:MouseEvent){

turntable.addEventListener(Event.ENTER_FRAME, fl_RotateContinuously);

}

So, for the stop button have it call another function that would be like this:

function stopturning(e:MouseEvent){

turntable.removeEventListener(Event.ENTER_FRAME, fl_RotateContinuously);

}

1 reply

Colin Holgate
Colin HolgateCorrect answer
Inspiring
November 29, 2016

If you look at the code snippet it has a line like this ('turntable' is the name I gave the movieclip, your name is most likely different):

turntable.addEventListener(Event.ENTER_FRAME, fl_RotateContinuously);

If you have made that work with a button click, it's going to be something like:

function startturning(e:MouseEvent){

turntable.addEventListener(Event.ENTER_FRAME, fl_RotateContinuously);

}

So, for the stop button have it call another function that would be like this:

function stopturning(e:MouseEvent){

turntable.removeEventListener(Event.ENTER_FRAME, fl_RotateContinuously);

}

maidenskull
Participant
November 30, 2016

Colin, Thank you so much!

This worked! I put in the code you suggested and then put in a 'stop at this frame' command, and it works perfectly!!