3 Replies Latest reply on Jan 2, 2011 6:28 AM by Ned Murphy

    New in AS2...

    forsakenedsj Level 1

      Hello all, I'm a newbie in AS2 and would like some assistance in it...

       

      I got a 'Tag' Layer which allows me to name my frame:

      1 - Welcome

      51 - Home

      101 - Transitions

      161 - About

      176 - End

       

      I got a 'Actions' layer which allows me to put my AS2 inside...

      Frame number
      actionscripts
      50stop();

      enter_btn.onRelease = function()
      {
          gotoAndPlay(51);
      }
      100stop();

      abt_btn.onRelease = function()
      {
          gotoAndPlay("Transitions");
      }

      end_btn.onRelease = function()
      {
          gotoAndPlay("Transitions");
      }

       

      Basically, when it plays.. It will play frame 1 - 50 and stop at 50 to listen to a button called enter_btn if user clicks it will continue till 100 and stops again.

       

      Inside there, there will be 5 buttons for user to click. any 5 button will play "Transitions" which is frame 101 - 160.

       

      Is there anywhere at frame number 160 or whatever that can put this following actions that I wanted:

      - track which button that has been click and plays the specific frame name? (e.g.: clicked on abt_btn > transitions will be played (frame 101 - 160) > and plays "About" at frame no. 161 - 175) (another e.g.: clicked on end_btn > transitions will be played (frame 101 - 160) > plays "End" at frame 176 - 190)

        • 1. Re: New in AS2...
          Ned Murphy Adobe Community Professional & MVP

          The specifics of what you are after escape me, but you can have a variable that you use to keep track of which button gets clicked.  Anytime a button gets clicked you have that button's code assign the desired value to that variable.  That way you can use that variable when you get to whatever frame you intend to use that information.

           

          What I usually do is have a couple of layers for actions.  One that has variables and functions that are shared and one for frame-specific code (such as what you have shown so far).  The first one would only have code in frame 1, but it will extend the full length of the timeline so that what is in it can be assigned/retrieved/used anywhere along the timeline.

          • 2. Re: New in AS2...
            forsakenedsj Level 1

            how to assign variable then?

            • 3. Re: New in AS2...
              Ned Murphy Adobe Community Professional & MVP

              Just as an example using what you showed...

               

              stop();

               

              abt_btn.onRelease = function()
              {
                  yourVariable = whatever;

                  gotoAndPlay("Transitions");
              }

               

              end_btn.onRelease = function()
              {

                  yourVariable = whatever_else;
                  gotoAndPlay("Transitions");
              }