7 Replies Latest reply on Jul 18, 2013 9:04 AM by kglad

    Controlling movie clips on a previous frame

    tallmidget

      Hello all,

       

      I'm looking at trying to control a move clip on a previous frame. Here's a setup for you:

       

      Frame 1 - I have a movie clip that has 3 frames, when the frame is entered, the movie clip starts frame 2, when I go to the next frame, I have the movie clip go to frame 3. I want to be able to go to a previous frame, and have the movie clip go to frame 1, instead of it going to frame 2.

       

      In the Actionscript layer of the fla, I have it set to where that movie clip will go to the second frame. Is there anyway around this?

       

      Thanks

        • 1. Re: Controlling movie clips on a previous frame
          kglad Adobe Community Professional & MVP

          Frame 1

          of the _root timeline?

           

          I have a movie clip that has 3 frames, when the frame

          frame 1 of the _root timeline?

           

          is entered, the movie clip starts frame 2

          frame 2 of the movieclip?

           

          , when I go to the next frame

          next frame of the _root timeline (ie, frame 2)?

           

          , I have the movie clip go to frame 3

          frame 3 of the movieclip?

           

          . I want to be able to go to a previous frame

          the _root timeline's previous frame (ie, frame 1)?

           

          , and have the movie clip go to frame 1

          the movieclip's frame 1?

           

          • 2. Re: Controlling movie clips on a previous frame
            tallmidget Level 1

            Sorry. i didn't realize how confusing that was haha

             

            Frame 1

            of the _root timeline? No, it's actually a part of it's own movie clip. but for all intents & purposes, let's say it is the root timeline. I'm more looking for a push in the right direction.

             

            I have a movie clip that has 3 frames, when the frame

            frame 1 of the _root timeline? Yes

             

            is entered, the movie clip starts frame 2

            frame 2 of the movieclip? Yes

             

            , when I go to the next frame

            next frame of the _root timeline (ie, frame 2)? Yes

             

            , I have the movie clip go to frame 3

            frame 3 of the movieclip? Yes

             

            . I want to be able to go to a previous frame

            the _root timeline's previous frame (ie, frame 1)? Yes

             

            , and have the movie clip go to frame 1

            the movieclip's frame 1? Yes

            • 3. Re: Controlling movie clips on a previous frame
              kglad Adobe Community Professional & MVP

              what causes the _root timeline to change frames?

               

              mouse clicks?  key listeners?  something else?

              • 4. Re: Controlling movie clips on a previous frame
                tallmidget Level 1

                Right now, it a button that changes it.

                • 5. Re: Controlling movie clips on a previous frame
                  kglad Adobe Community Professional & MVP

                  if your movieclip has instance name mc, have your button handler call mcF:

                   

                  var prevFrame:Number=1;

                  mc.gotoAndStop(2);

                   

                  function mcF():Void{

                  if(prevFrame<_root._currentframe){

                  mc.gotoAndStop(1);

                  } else if(prevFrame>_root._currentframe){

                  mc.gotoAndStop(3);

                  } else {

                  mc.gotoAndStop(2);

                  }

                  prevFrame=_root._currentframe;

                  }

                  • 6. Re: Controlling movie clips on a previous frame
                    tallmidget Level 1

                    Not sure if I changed the code right, but my button that is controlling the movie clip is 4 steps up on in the FLA. But not on the root. So I'll got the code in my frame as:

                     

                    _parent._parent._parent._parent.up_btn.onPress = function() {
                    _parent.prevFrame();
                    var prevFrame:Number = 1;

                    SS6_mc.gotoAndStop(2);


                    function mcF():Void {

                      if (prevFrame<_parent._currentframe) {

                       SS6_mc.gotoAndStop(1);

                      } else if (prevFrame>_parent._currentframe) {

                       SS6_mc.gotoAndStop(3);

                      } else {

                       SS6_mc.gotoAndStop(2);

                      }

                      prevFrame = _parent._currentframe;

                    }


                    gotoAndStop(1);
                    };

                     

                     

                    With SS6_mc being the movie clip I want to go to the frame. Changing the _root to a _parent because the movie clip is one step up, this doesn't work. probably because it's not right in the instance.

                    • 7. Re: Controlling movie clips on a previous frame
                      kglad Adobe Community Professional & MVP

                      i'm not sure what you're trying to do with that code but try:

                       

                       

                      SS6_mc.gotoAndStop(2);

                      var prevFrame:Number=1;

                       

                      _parent._parent._parent._parent.up_btn.onPress = function() {
                      _parent.prevFrame();

                      mcF();

                      };

                       

                       

                       


                      function mcF():Void {

                        if (prevFrame<_parent._currentframe) {

                         SS6_mc.gotoAndStop(1);

                        } else if (prevFrame>_parent._currentframe) {

                         SS6_mc.gotoAndStop(3);

                        } else {

                         SS6_mc.gotoAndStop(2);

                        }

                        prevFrame = _parent._currentframe;

                      }