2 Replies Latest reply on Nov 30, 2016 5:36 AM by maidenskull

    stopping a rotate continuously command

    maidenskull

      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!

        • 1. Re: stopping a rotate continuously command
          Colin Holgate MVP & Adobe Community Professional

          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);

          }

          • 2. Re: stopping a rotate continuously command
            maidenskull Level 1

            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!!