Skip to main content
Participating Frequently
December 8, 2013
Question

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

  • December 8, 2013
  • 1 reply
  • 960 views

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?

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
December 8, 2013

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

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

Participating Frequently
December 9, 2013

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?

Ned Murphy
Legend
December 9, 2013

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.