4 Replies Latest reply on Dec 9, 2013 11:02 AM by AdobeNewbey

    stop() does not work as expected in AS2.0

    AdobeNewbey

      I am using Adobe Flash CS6 and ActionScript 2.0.

       

      I have a button that that is a bit complicated. Not only do I want it to pause the movie clip, I want it to pause all the movie clips that are inside that movie clip.

       

      Everything is working perfectly except the last part. When the movie clip is on the last frame (everything has played), the animation continues ever AFTER I have pressed the "pause" button.

       

      This is the code I have on my button:

       

      ---------------------------------------------------

      on (release) {

          button_SpaceshipStop._visible    =    false;

          button_SpaceshipPlay._visible    =    true;

          mc_Spaceship.stop();

       

          if(this.mc_Spaceship._currentFrame != mc_Spaceship._totalFrames)

          {

              if( (this.mc_Spaceship.AnimatedShip_currentFrame >= 34 ) &&

                 (this.mc_Spaceship.AnimatedShip_currentFrame <= 57) )

                  {

                  mc_Spaceship.RetractLegs.stop();

                  }

                

              if( (this.mc_Spaceship.AnimatedShip_currentFrame >= 148 ) &&

                 (this.mc_Spaceship.AnimatedShip_currentFrame <= 172) )

              {

                  mc_Spaceship.ExtendLegs.stop();

              }

                

              if(this.mc_Spaceship.AnimatedShip_currentFrame >= 173)

              {       

                  mc_Spaceship.AnimatedShip.stop();

                  mc_Spaceship.AnimatedShip.AlienAnim.stop();

                  mc_Spaceship.AnimatedShip.AlienAnim.EyeLeft.stop();

                  mc_Spaceship.AnimatedShip.AlienAnim.EyeRight.stop();

                  mc_Spaceship.AnimatedShip.SpinningAntenna.stop();

                  mc_Spaceship.AnimatedShip.SpinningBottom.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights1.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights2.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights3.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights4.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights5.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights6.stop();

              }

          }

          else

          {

                  mc_Spaceship.AnimatedShip.stop();

                  mc_Spaceship.AnimatedShip.AlienAnim.stop();

                  mc_Spaceship.AnimatedShip.AlienAnim.EyeLeft.stop();

                  mc_Spaceship.AnimatedShip.AlienAnim.EyeRight.stop();

                  mc_Spaceship.AnimatedShip.SpinningAntenna.stop();

                  mc_Spaceship.AnimatedShip.SpinningBottom.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights1.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights2.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights3.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights4.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights5.stop();

                  mc_Spaceship.AnimatedShip.SpinningHeadlights6.stop();

          }

      }

      ---------------------------------------------------

       

      Ideas?

        • 1. Re: stop() does not work as expected in AS2.0
          Ned Murphy Adobe Community Professional & MVP

          The correct terms are _currentframe and _totalframes  (no uppercase letters)

           

          You should get code off of objects and keep it in the timeline.

          • 2. Re: stop() does not work as expected in AS2.0
            AdobeNewbey Level 1

            Thank you for the quick response and all the help you have been giving me. This is the last leg of my learning ActionScript 2.0. I know that 3.0 does not allow AS on objects.

             

            Anyway, for now, lets just leave it where it is.

             

            As far as the capatalization is concerned, the program puts the capital "F" there when I select from the code snippets area. Is it possible that it works either way?

             

            I have tried it with and without the capital "F" and I still get the same results.

             

            Do you have any ideas why everyhting works EXCEPT when it is on the last frame?

             

            Using the code above, how would you frame a trace() statement?

            • 3. Re: stop() does not work as expected in AS2.0
              Ned Murphy Adobe Community Professional & MVP

              I cannot tell what is not working for the code you show.  Your description of the problem is not tying in to the code you show.  It might be clear to you what is what, but you haven't provided enough info for someone else to make it out.

               

              I cannot tell you what you might want to trace to see why something is not working.  You should be able to though.

               

              If all of your code was in the timeline there would be less complication to your coding because everything is then referenced from the same place. 

              • 4. Re: stop() does not work as expected in AS2.0
                AdobeNewbey Level 1

                I hear you. I just do not know how to move my code to the timeline. Other than setting up background music, all of the code is on the specific buttons that they apply too.

                 

                I am not sure what to do from here.

                 

                Isn't there a specific ActionScript code snippet that stops a all movie clips regardless of how deeply they are embedded into other movie clips?

                 

                For example, I have the movie clip for the entire spaceship animation, with background images, etc.     (Instance: mc_Spaceship)

                Inside of that, I have a movie clip that contains the spaceship itself     (Instance: SpaceshipAnim)

                Inside of that, I have a movie clip that contains the alien in the ship     (Instance: AlienAnim)

                Inside of that I have a movie clip that controls the blinking of his eyes.     (Instance: EyeRight & EyeLeft)

                 

                Well, you can see all of that in the code above.

                You see how complicated that it? What was I thinking?