0 Replies Latest reply on Jul 11, 2006 11:48 AM by Shendy_Kurnia

    array as object's name

    Shendy_Kurnia
      Hi,
      I am a newbie in actionscripting. However, I do have a background in c++ and java programming.

      I make a flash with 12 movie clips. I want them move depending on the mouse's position.
      I have the code so that it works to one of the instance, let's call it "movclip1".
      Then, I apply that code to all of the 12 instances.
      I can make arrays for the positions and sizes of those 12 instances. However, I have to do like this since I can't use array as the instance's name.

      for(int i=0;i<12;i++)
      {
      if(i==0) { movclip1._x++; movclip1._y--; }
      if(i==1) { movclip2._x++; movclip2._y--; }
      if(i==2) { movclip3._x++; movclip3._y--; }
      ...
      }

      My code is longer than that. I wish I could just put the instance's name as an array so the code won't be tiring like that.
      Any suggestion? Thank you in advance.

      -Shendy