4 Replies Latest reply on Sep 23, 2007 3:08 PM by kglad

    Is that a good scripting practice?

    mlsmet
      When I have to work with ActionScript 1, I still use prototypes.
      But a friend of mine prefers using another method (see example below).
      It looks like classes (sort of). It works fine but is it a good scripting practice? Better than using prototypes with AS1?

      clip1.fadeMe = function(out, speed) {
      this.onEnterFrame = function() {
      if (out) {
      (this._alpha>speed) ? this._alpha -= speed : delete this.onEnterFrame;
      } else {
      (this._alpha<100) ? this._alpha += speed : delete this.onEnterFrame;
      }
      };
      };
      clip1.onRollOver = function() {
      this.fadeMe(true, 25);
      };
      clip1.onRollOut = function() {
      this.fadeMe(false, 25);
      };

      Thanks for your comments.
      Serge