How do i create new labels dynamically with actionscript in a for loop


I am trying to write code to read from an xml file which i have done succesfully and create new labels each time the code loops that would have as text the data in the xml file.

i want the first label to have as text Kelly Maker, the 2nd as Mike Grundvig and so on.I also want all the labels to move across the stage just as the first one does.

What i have now is a single text that shows the last name which is Freed Maker. i tried using the duplicateMovieClip but all it did was to create 2 static labels (that dont move as i want it) that have as text undefined.

Please help me out here.



<Name Gender=“female”>Kelly Makar</Name>
<Name Gender=“male”>Mike Grundvig</Name>
<Name Gender=“male”>Free Makar</Name>
<Name Gender=“male”>Freed Makar</Name>


Action Script

var i:Number = 0;
for (var aNode:XMLNode = xmlFile.firstChild.firstChild.nextSibling; aNode != null; aNode=aNode.nextSibling)

     if (aNode.nodeType == 1) {

            duplicateMovieClip ("my_label",my_label, i);
            my_label.text = aNode.firstChild.nodeValue;
            my_label.visible = true;

var xPost:Tween = new Tween(my_label, “_x”, Regular.easeOut, 450, -100,20, true);