Toyfruit
07-08-2008, 11:36 AM
Hi all, I'm just trying to learn AS3 and am having some trouble ...
I have 4 library items (all movie clips), named as mc0, mc1, mc2, mc3. The linkage is set so the class name is the same.
I want to create an array with the class names in, so I have:
var mcNames:Array = new Array(mc0, mc1, mc2, mc3);
I then want to be able to loop through (either using a for or if statement) and dynamically attach the items to the stage by looping through the array. So my code would be like:
for (var i:Number = 0; i<mcNames.length; i++){
// put an instance of the movieclip on the stage that
//has the same name as the current item in the array.
//So for example, if the first item in the array is mc0,
//then the item attached to the stage will be the
//movieclip mc0 from the library --- but how do I do it????
}
Any help would be greatly appreciated
I have 4 library items (all movie clips), named as mc0, mc1, mc2, mc3. The linkage is set so the class name is the same.
I want to create an array with the class names in, so I have:
var mcNames:Array = new Array(mc0, mc1, mc2, mc3);
I then want to be able to loop through (either using a for or if statement) and dynamically attach the items to the stage by looping through the array. So my code would be like:
for (var i:Number = 0; i<mcNames.length; i++){
// put an instance of the movieclip on the stage that
//has the same name as the current item in the array.
//So for example, if the first item in the array is mc0,
//then the item attached to the stage will be the
//movieclip mc0 from the library --- but how do I do it????
}
Any help would be greatly appreciated