3 Replies Latest reply on Mar 18, 2007 4:21 PM by kglad

    mc in timeinterval fails?

    jagguy99 Level 1
      Hi,

      I can't access the properties of a MC in a function using array notation.

      eg this works when using mc2 but fails when using this["mc"+2]._x?

      I need array notation for mc but I can't get it to work in a function called by a timer. It works for a function not called by a timer.

      [CODE]
      tum=setInterval(fade,10,swap);

      function fade(a:Number):Void
      {
      //if (a>0)trace(a);
      i=3;
      j=2;
      //trace(this._parent["mc"+2]._x);//undefined
      trace(this["mc"+2]._x); //undefined why?
      trace(j);
      this["mc"+2]._x=10;
      trace(this["mc"+2]._x);
      trace(mc2._x);//works

      //trace(mc2._x);
      if (this["mc"+j]._parent._x >=0)
      this["mc"+j]._alpha -=1;

      if (this["mc"+i]._parent._x <=100)
      this["mc"+i]._alpha+=2;

      if (this["mc"+i]._alpha >=100)
      {
      //trace(a);
      a=a+1;
      clearInterval(tum);
      // tum=setInterval(fade,10,a);
      }

      }


      [/CODE]

      q)The reason I am doing this is to create a MC that loads a different picture every minute that you see everywhere. Now the setInterval fails to do this so do I need to use a getTimer to measure time?