2 Replies Latest reply on Jun 2, 2010 1:26 PM by kgrote10

    gotoAndStop goes to frame but doesn't stop


      I'm making a slideshow which pauses on each slide for 10 seconds, and there are also navigation buttons to go to each slide independently. I have this code (which I got off the interwebs) in a separate actions layer to pause the slideshow, independent of any button actions. This, for example, is an action on frame 2:




          var nInterval = setInterval(Play, 10000);


          function Play() {


      The buttons use this script:




      The pause code was overriding the button's "stop" action when I set it to go to the same frame: gotoAndStop(2). So I created a duplicate frame (frame 1) before the pause script, and told the button to go there: gotoAndStop(1). Since there are no actions on that frame I thought the stop action would work normally, but when I click the button, it goes to the correct frame (frame 1) but the movie continues playing after 10 seconds, instead of stopping.


      I probably explained it terribly, but I'm just trying to figure out why gotoAndStop isn't stopping when it's sent to a blank frame. Thanks!

        • 1. Re: gotoAndStop goes to frame but doesn't stop
          Ned Murphy Adobe Community Professional & MVP

          Yeah, I'm not sure I followed the explanation, but one thing that might be causing the problem is that the setInterval may be in play still while you head back to frame 1, so when it times out it will go on to wherever.  You may need to have your use of the button also clearing the interval.


          If your ttimeline travel involves primarily moving to next and previous frames, you might want to try using nextFrame() and prevFrame() instead of gotoandWhatever.  Their duty in life is to move to the next or previous frame and stop.  It might allow you to not have to code every frame and could allow you the use of one button instead of one for each frame.

          • 2. Re: gotoAndStop goes to frame but doesn't stop
            kgrote10 Level 1

            Thanks Ned, I'll give it a try. I'm going to try and post an example later in the day to compensate for my poor storytelling.