1 Reply Latest reply on Jul 14, 2006 2:21 PM by Peter Lorent

    Dynamicaly naming an object

      Let's say I have a class named MyBox and I want to create a certain number of objects from that class in a loop. How do I do it ?

      for (var i:Number = 1; i < 4; i++){
      var ["b" + i]:MyBox = new MyBox ("box" + i);

      I was hoping that the above code would create 3 objects (b1, b2 and b3) of the class MyBox (the first one getting "box1" as a parameter, the second one "box2" and the last one "box3").

      Can anyone help me with this code ? It should be quite simple but I can't figure it out.