5 Replies Latest reply on Jul 21, 2006 4:47 PM by Newsgroup_User

    Interval setting & scope issue for a Function on a MovieClip

    a.neko®
      For a script as follows (in this case concerning a MovieClip):

      // script
      public var clipA:MovieClip;
      public function createClip():void {
      this.clipA = new MovieClip ()
      this.clipA.clipAFunction = function ():void {
      trace(this);
      }
      this.addChildAt(clipA,0);
      return;
      }


      Calling this.clipA.clipAFunction() traces [object MovieClip], which is the intended result, while calling this.clipA.interval = setInterval(this.clipA.clipAFunction, 1000) traces [object global].

      I've found a description of this situation in ActionScript 3.0 documentation. However, I haven't found any method to solve a similar situation, when an interval needs to be set from a different object that the one containing the required function, so I would appreciate any help with this issue.

      a.neko