I am inporting thumbnail images from an xml file. I would like to be able to dynamically assign actionscript for each thumbnail, so when clicked it will load a larger image into an image container. I was able to get the actionscript to load an image into the container when a button is clicked, but it is always the same one. So I am not assigning the correct xml attribute to each button, it is basically just taking the last xml attribute and showing that large image for each one. So, how would I assign a unique variable to each dynamically imported image so it knows which larger image to pull. here is the code I am currently using:

Code:
pics.onLoad = function(success)
{
        if(success)
        {
			trackNum = pics.firstChild.childNodes.length;
			

			
			for(k=0; k<2 ; k++){
				for(l=0; l<3; l++){
					pictainer.duplicateMovieClip("pic" + num, num+1);

					setProperty("pic" + num, _x, pictainer._x + (gridx * k));
					setProperty("pic" + num, _y, pictainer._y + (gridy * l));


					
					
					//this["raceText" + num].race.text = raceName;
					picHolder = pics.firstChild.childNodes[num];
					this["buttonPress" + num] = pics.firstChild.childNodes[num].attributes.large
					loadMovie(picHolder.attributes.thumb, ["pic" + num]);
					trace(this["buttonPress" + num]);
					num++;
					trace(picHolder.attributes.thumb);
					
					//onPress Functionailty
					["pictainer" + num]onMouseDown = function(){
						loadMovie(this["buttonPress" + num], "_root.subMenu.imageContainer");
					}
				}
			}
		}
}