2 Replies Latest reply: Oct 26, 2007 8:32 AM by Mithrandirself RSS

    Ajusting to the AS 2.0/3.0

    Forstias
      Hello

      Iv been struggling abit with the new way that AS should be written. (im the old school flash scripter dropping scripts everywhere :) ). I understand the basic principle of classes and have been testing with them, but what i realy miss is, or are unable to find out, is how to contuniuesly update the behaviour of objects with a script. It used to be easy, just an onEnterFrame and you knew the script was running at every refresh. This is not the case however with classes that I make, they only run codes once. So how do I encorporate that it keeps updating the position of objects for example?
        • 1. Re: Ajusting to the AS 2.0/3.0
          hotdes
          For example, for subject Hero create file Hero.as:
          class Hero extends MovieClip {
          function Hero() {
          }
          function onEnterFrame() {
          _x++; // for example,move Hero every frame right +1 px
          }
          }
          • 2. Ajusting to the AS 2.0/3.0
            Mithrandirself
            I've only done AS3 stuff so far, and honestly not alot of it, but I think one of the big changes that occured has to do with listeners. Many of the onRelease() type functions use listeners now.

            So for instance onRelease is basically the MouseEvent.CLICK

            In the below example the instance name of the button is (instanceName), and the function is named (gotoFunction)

            Bottom line is, you'll probably have to do a little research to find these new events.