issue trying to populate a dynamic container from library with data.
I have an mc that lives in the library with a linkage identifier of "container".
It has a empty_mc labeled "holder" for the loaded image and a text field labeled "name". When I run the script it places 2 instances of the container mc on the stage but it should be placing 10 and it also doesn't populate the textfield with the name value. What am I doing wrong?
Code:
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function(success:Boolean):Void {
if (success) {
var i:Number;
var itemMens:Array = XPath.selectNodes(this, "/departments/department[@name='MENS']/item");
var itemWomens:Array = XPath.selectNodes(this, "/departments/department[@name='WOMENS']/item");
//For loop to attach our container movieclip and pass the array information
//Starting x & y values
var xPos = 60;
var yPos = 60;
for (i=0; i<itemMens.length; i++) {
//attach the container clip
attachMovie("container", "new"+i, i, {_x:xPos, _y:yPos});
//increase the y postion each time
xPos += this["new"+i]._width+5;
//add the information
this["new"+i].name.text = itemMens[i].attributes.name;
this["new"+i].interest.text = itemMens[i].attributes.price;
this["new"+i].link = itemMens[i].attributes.url;
this["new"+i].image = itemMens[i].attributes.image;
trace(itemMens[i].attributes.price);
}
} else {
trace("Error Loading XML");
}
};
xml.load("content.xml");
If I add trace (itemMens.length) inside the for loop it outputs 10 so why is it not places ten instances of container on the stage.