3 Replies Latest reply: Mar 31, 2009 1:32 PM by Greg Dove RSS

    Variable Variable Names

    BrianatArena Community Member
      I'm looking for a way to insert a variable into a variable name. I have this bit of as3 code: I'd like to replace #### with a variable myNumber but don't know the syntax.

      var item####:MovieClip = new itemMC();
      addChild(item####);
      item####.x = 10;
      item####.y = 350;

      Assuming I defined myNumber with "1" earlier on, how can make the code above function as if it were this?:

      var item1:MovieClip = new itemMC();
      addChild(item1);
      item1.x = 10;
      item1.y = 350;

      Thanks for any help!