3 Replies Latest reply on Mar 12, 2017 2:21 PM by Timmonsxp

    Using a button to go back in the timeline

    Timmonsxp

      Hello I am having trouble with a button I want to use. I have 2 sets of looping frames and a button for each set to navigate between the 2 sets. I got the first button to work using the basic action script.

       

      FastSymb.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_16);

       

       

      function fl_ClickToGoToAndPlayFromFrame_16(event:MouseEvent):void

      {

        gotoAndPlay(435);

      }

       

      It works fine and it navigates me forward into the 2nd looping frame set. I did the same thing for the 2nd button to navigate me backwards in the timeline back to the first set of looping frames but it doesn't work. I used the actionscript.

       

      SlowSymb.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_17);

       

       

      function fl_ClickToGoToAndPlayFromFrame_17(event:MouseEvent):void

      {

        gotoAndPlay(397);

      }

       

      I'm guessing you cant go backwards in the timeline without a special script or something? Please give me a hand!

       

      Timeline1.PNG

        • 1. Re: Using a button to go back in the timeline
          Colin Holgate MVP & Adobe Community Professional

          Your script for the second button is in frame 434, but you're playing from frame 435. I guess that the script at the end of the fast loop is also gotoAndPlay(434). If it is then the listener will get added then. Do you notice if the button works after the first loop?

           

          If your end script is gotoAndPlay(435), then the second button listener never gets added.

           

          You should look into using frame labels. Then you could have labels of slowloop and fastloop, and you would say gotoAndPlay("fastloop");. That way if you need to add frames you don't have to change the frame numbers that you used.

          • 2. Re: Using a button to go back in the timeline
            ClayUUID Adobe Community Professional

            Furthermore, messily bouncing around the main timeline like this is exactly why movieclips exist. You should put each of those spans in its own sub-clip.

            1 person found this helpful
            • 3. Re: Using a button to go back in the timeline
              Timmonsxp Level 1

              TL.PNG

              Thanks for your replies everyone. The issue was my own. I'm still VERY new to all of this. I've had the program for 4 days so I don't really understand movie clips and their own timelines. I will definitely study. I didn't notice the little number at the bottom that says what frame i'm on currently so to be completely honest I was counting frames and I messed up. In my action script I used the wrong frame numbers. After using the frame number at the bottom and re doing the action script it works fine. I do agree that my timeline is sloppy and kind of annoying to navigate so I will look into movie clips. Thank you ClayUUID. And thanks Colin for pointing out that my frame placement was off.