I have a collection of instances of a moveClip that already exist in my timeline named emptyThumb_mc0, emptyThumb_mc1, etc.
I'm using XML and a loop to load external images one at a time and I'm trying to cycle through and add them to each of the movieClips using AddChild.
AddChild works just fine if I hardcode the name of the target movieclip like this:
except of course, then all my images are loaded into that one MovieClip.
I want to use the variable from my loop to cycle through each target movieclip so I changed the code to this:
When I change the code to this, I get an 'Error#1010 A term is undefined and has no properties. I've traced the i value and it is has a correct value through each loop. So... is my syntax incorrect, or is just impossible to put a variable into the target path like this?
I've attached the relevant function code
//function that dynamically displays thumbnails
//take data from XML import and put it into an array variable
xml = XML(event.target.data);
xmlList = xml.children();
//loop that creates a new image loader for each item in the list of images
for(var i:int = 0; i < xmlList.length(); i++)
imageLoader = new Loader();
//get the path to the thumbnail image file for each loader
//set position for the loader on the stage
imageLoader.x = 0;
imageLoader.y = 0;
//collect path name to large image for each thumbnail and save as the name attribute
imageLoader.name = xmlList[i].attribute("source");
//add thumbnail to the stage
//add listener to thumbnail to react to a mouse click to show full-size image