More information about the Underscore mailing list

[_] concatenation in a for loop (AS2)

Simon Johnson simon at
Tue Aug 21 10:53:28 BST 2007

im creating a set of movieclips on the fly and loading a image from file 
in to each of them

now in this instance ive only got 10 to create but each one itteration 
is 6 lines of almost identical code
realy i would like to spawn them all in a for loop
the difficulty is in the referencing of the mc's once they are spawned 
to load th image and set their properties
heres some code:

for(var i:Number=0;i<=10;++i){
                _root.lhand.screenText.pinbox1._x=10;//clearly this will 
only set the _x for the first mc spawned
                _root.lhand.screenText.pinbox1._y=(30+(10*i));// as above
_root.lhand.screenText.getNextHighestDepth(), 30, (30+(10*i)), 100, 

is there some way to force the compiler to generate a new variable name 
on each iteration ?