I'm trying to use XML to load in 4 images to a movieclip
within a movieclip that is already created on the stage. I'm trying
to do this in a loop since there are 4 movie clips I'm trying to
access. I can get it working without the loop, but it's figuring
out the syntax that's causing the problem. Currently I have the
following code:
function ParsePics(picsInput:XML):void {
var picsList:XMLList = picsInput.pic.image;
for (var i:int = 0; i < picsList.length(); i++) {
var picsElement:XML = picsList
;
var imageURL = "images/stories/homeflash/" + picsElement;
var loader:Loader = new Loader();
var pic_mc = pics.getChildByName("pic" + (i+1));
pic_mc.addChild(loader);
loader.load(new URLRequest(imageURL));
}
}
The line causing the issues is var pic_mc =
pics.getChildByName("pic" + (i+1));
I'm not sure how to access all 4 movieclips - pic1, pic2,
pic3 and pic4 without preforming the step 4 separate times. any
ideas on what I'm doing wrong?