6 Replies Latest reply on Mar 22, 2007 8:33 AM by BSquared40

    Need Help with Navigation Buttons

    BSquared40
      Hi,

      What I'm seeking should be straightforward for those of you who have mastered ActionScript. (I'm using Flash 8 Professional.)

      I have 84 photographs that progressively show one complete rotation of a photographed object (a model airplane). What I'm envisioning are a pair of buttons. When the "forward" button is pressed, the plane would rotate clockwise, and stop rotating when the button is released. Same for the "reverse" button, but the action would be counterclockwise. In that way, the viewer can control exactly what angle to look at.

      I assume I'd put each of the photographs on a Flash frame and use ActionScript on the buttons to make Flash go through the frames as described above.

      Please let me know what the AS code would be, or perhaps provide a link to someplace where it is explained.

      Thanks!
      Bill
        • 1. Re: Need Help with Navigation Buttons
          kglad Adobe Community Professional & MVP
          create a movieclip and place each of your 84 images on one frame of that movieclip's timeline. ie, the first image will be on frame 1, 2nd image on frame2 etc. place your movieclip on the main timeline and give it an instance name, say apMC. you'll probably want to put a stop() in its first and last frames.

          then if you have forward and backward buttons with instance name forwardBtn and backwardBtn on the main timeline, you can use:

          • 2. Re: Need Help with Navigation Buttons
            BSquared40 Level 1
            Thanks! I'll try it and let you know how things go, or if I have questions.

            Bill
            • 3. Re: Need Help with Navigation Buttons
              kglad Adobe Community Professional & MVP
              you're welcome.
              • 4. Re: Need Help with Navigation Buttons
                BSquared40 Level 1
                kglad,

                I (think) I followed your instructions. The airplane rotates fine when the forward button is pressed, but nothing happens when the backward button is pressed. I’ll describe exactly what I did, in case I did something wrong.

                1. I drew a small dot off stage, made it into a movieclip object, and gave it the name apMC.

                2. On the movieclip timeline, I created a keyframe for each photo and dragged the photos from the library onto the keyframes. I placed a stop() code on the first and last movieclip frames.

                3. On the main timeline, I created three layers:
                “Movieclip”: Onto the first frame of this layer I copied/pasted the code that you provided.
                “Button Labels.”
                “Buttons”: I created the forward and backward buttons, giving them the instance names you suggested.

                Any thoughts as to why the backward button doesn’t work? If you wish, I could send you the .fla file to examine. If so, let me know where to send it.

                Thanks!
                Bill
                • 5. Re: Need Help with Navigation Buttons
                  kglad Adobe Community Professional & MVP
                  delete that dot. it serves no purpose.

                  your backward button needs to be a movieclip button. true buttons don't have onEnterFrame methods.
                  • 6. Re: Need Help with Navigation Buttons
                    BSquared40 Level 1
                    I see! Thanks!

                    I changed the code on the last movieclip frame from stop() to gotoAndPlay(2) so that when the plane is rotating forward there is no stop in the action when the last frame is reached.

                    With the change you suggested, now the airplane rotates backward when the backward button is pressed. However, the action stops when the first frame is reached.

                    Is there a way to modify the code so that, when using the backward key, the rotation can continue beyond the first frame, the way the action continues beyond the last frame when the rotation is forward?

                    Bill