6 Replies Latest reply on Jun 30, 2009 10:29 AM by heazle

    How to skip an action

    heazle

      I have a swf file "home" that has a series of animations that are button controled.

      I want part of the animation to be skipped when I click one specific button, for instance

      Most of the time I want frame label:"1 out" to play all the way through to the last frame (20) and on frame (20) there is an action sending it back to frame 1and stopping, but I need to have a button that when hit plays frame label 1: "1 out" and continues to frame (19) and does not utilize the action on frame (20) sending it back to frame (1), or in other words playing through "1 out" and then playing "2 out" which occurs on frame 21 without returning to frame (1).

        • 1. Re: How to skip an action
          Ned Murphy Adobe Community Professional & MVP

          Chances are you need to have the button set a variable that you will test in a conditional at frame 19 to determine which action to take.

          • 2. Re: How to skip an action
            heazle Level 1

            I am somewhat of a novice to flash, could you give me an example.

             

            Mark Heazle

            Hummel Architects PLLC

            p: 208.343.7523  f: 208.343.0940

            2785 Bogus Basin Road.  Boise, Idaho 83702

            • 3. Re: How to skip an action
              Ned Murphy Adobe Community Professional & MVP

              I didn't really follow your explanation of frame skipping, and you haven't indicated what version of Actionscript you're using, so you'll have to try to work with this... create a variable:

               

              var skipFrame:Boolean = false;

               

              For the button code, assuming the button is clicked to skip frames, have it set that value to true ( skipFrame = true; )

               

              Then, in frame 19 (assuming that's where the decision to skip needs to be made) test the status of the skipFrame variable...

               

              if(skipFrame){

                   skipFrame = false; // if you plan to reset it once it's used

                   gotoAndPlay(?);   // got wherever you intend when you skip

              } else {

                   play();

              }

              • 4. Re: How to skip an action
                heazle Level 1

                Thank you for the help

                I am using action script 2.0

                 

                For the button action I used

                on (release) {

                     gotoAndPlay("1out"); //animates for 19 frames

                     skipFrame = false;

                }

                 

                On frame 19 I used the script

                     var skipFrame:Boolean = false;

                if (skipFrame=false) {

                     gotoAndStop("begin");////goes to frame 1

                } else {

                     gotoAndPlay(20);

                }

                The code does not seem to work it plays all the way through to frame twenty even if I hit a button without the skipFrame = false; action

                 

                 

                Mark Heazle

                Hummel Architects PLLC

                p: 208.343.7523  f: 208.343.0940

                2785 Bogus Basin Road.  Boise, Idaho 83702

                • 5. Re: How to skip an action
                  Ned Murphy Adobe Community Professional & MVP

                  You missed the part about the button setting the skipFrame value to true.  I don't see where your code ever sets it to true.

                   

                  Also, your conditional is using the wrong syntax... = is used to equate something to something, == is used to compare something to something

                   

                  if (skipFrame==false) {

                   

                  In the case of testing a Boolean value, you don't need to compare anything, and can simply test the value, as in...

                   

                  if(!skipFrame) // passes if FALSE

                   

                  if(skipFrame) // passes if TRUE

                   

                  As uncertain as I was about the story behind what you want to do, I'm also uncertain what your intentions are for the code since it differs from what I provided.

                  • 6. Re: How to skip an action
                    heazle Level 1

                    Thanks for your patients and help so far

                    I think I am getting closer to having it figured out

                    What I am trying to do is play one series of frames labeled "1out" if you hit the button and after it runs to frame 19, and play a different series of frames "begin" if the specific button is not hit (a different button is hit) and when it reaches frame 19.

                     

                     

                    On (release) {

                       skipFrame == true; ////the code I am using when the button is hit and the } ////////////////////////animation plays to frame 19

                     

                     

                     

                    if (skipFrame==true) { ///////////the code I am using at frame 19 to tell it

                         gotoAndPlay("2in"); ////////which animation to play

                    } else {

                         gotoAndStop("begin");

                    }