Copy link to clipboard
Copied
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!
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:Mouse
...Copy link to clipboard
Copied
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);
}
Copy link to clipboard
Copied
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!!