3 Replies Latest reply on May 7, 2007 10:05 AM by Rothrock

    WARNING: Actions on button and MovieClip

    tmcquage
      I have the following code that I am trying to get to work with ActionScript 3.0:

      on (rollOver) {
      gotoAndPlay("s1");
      }
      on (releaseOutside, rollOut) {
      this.gotoAndPlay("s2");
      }
      on (release) {
      this.gotoAndPlay("s2");
      }

      The problem is that ActionScript 3.0 will not allow the script on a MovieClip instance. I am at a loss with what to do, I work well with examples, so I have posted 2 source FLA that are identical, the only difference is that one targets ActionScript 2.0 (and works), the other targets ActionScript 3.0 (and does not work).

      Please take a look
        • 1. Re: WARNING: Actions on button and MovieClip
          Rothrock Level 5
          Yes this is the case. No need to take a look. That is how AS3 works.

          There are a lot of changes in AS3 and in many ways it will be like learning AS all over again. There is no reason you have to use AS3. You can make CS3 Flash documents that are published for Flash player 9 and still conform to the AS2 style of coding.

          So what is the problem?
          • 2. Re: WARNING: Actions on button and MovieClip
            tmcquage Level 1
            I just cannot seem to grasp the changes that fast; so, is it correct to say that a MovieClip instance with frame labels containing stop(); in a frame is not supported with ActionScript 3.0?
            • 3. Re: WARNING: Actions on button and MovieClip
              Rothrock Level 5
              There is no need to grasp the changes that fast. You can still publish files for AS2.

              Personally though I am always amazed that folks are still using the on(clipEvent) style of coding. Generally that style of coding should have gone away with the introduction of the MovieClip.onClipEvent syntax with Flash 6 – introduced in Spring of 2002. If you have been programming AS since 2002 and are still relying solely on on(clipEvent) then you have bigger issues than AS3. If you have come to AS more recently I just wonder why this style was the one you adopted. (By "you" I don't mean you – tmcquage – specifically. I mean you in the general sense, and I include all of the Flash community in why did we allow this to happen.)

              You could probably answer that question yourself quick than posting here! But I just tested it and the stop(); works fine.

              I would recommend sticking with AS2 for the time being. Learn how to use all the movieclip methods from the main timeline, not from on an instance. Then the change over to AS3 won't be such a shock. Even if you never go to AS3, you will be so happy you stopped using instance code. Really.