Passing links through XML

Hi,

I’m trying to pass a list of links to dynamically created movieclips from an XML document. I’ve managed to get all the info into flash and I can trace the links fine. My problem ( I think) is that because the info is not being accessed until the user clicks on the movieclips (an onRelease function), only the last link being loaded is being used…so each movieclip is using only the last link (in this case, the 10th of 10 links being loaded in). Here is my function:


function populateNav(myXML) {
var featuresXML = myXML.firstChild.childNodes[1];
var totalXML:Number = featuresXML.childNodes.length;
var totalPosters = totalXML;
postersMC.itemsMC.button._visible = false;
var spacing:Number = postersMC.itemsMC.button.width+5;
var numberOfPosters:Number = totalPosters;
var i:Number = -1;
while (++i<numberOfPosters) {
var name:String = "button
"+i;
var image_path = featuresXML.childNodes*.childNodes[1].firstChild;
var place = featuresXML.childNodes*.childNodes[2].firstChild;
var date_call = featuresXML.childNodes*.childNodes[3].firstChild;
var link_to:Array = new Array();
link_to = [featuresXML.childNodes*.childNodes[4].firstChild];
postersMC.itemsMC.button.duplicateMovieClip(name, i);
postersMC.itemsMC[name]._x = i*spacing;
postersMC.itemsMC[name]._y = 0;
trace(link_to);
for (var j = -1; j<i; j++) {
loadMovie(image_path, postersMC.itemsMC[name].mc_buttonPicture.posterHolder);
postersMC.itemsMC[name].mc_buttonPicture.dateHolder.htmlText = date_call;
postersMC.itemsMC[name].mc_buttonPicture.placeHolder.htmlText = place;
postersMC.itemsMC[name].mc_buttonPicture.onRelease = function() {
trace(link_to);
};
}
}
}

I’ve gotten as far as setting up the link variable (link_to) as an array…but have no idea how to then assign that to the onRelease function of postersMC.itemsMC[name].mc_buttonPicture. As I mentioned, only the last link in the array is getting used. Any help would be greatly appreciated.

Thanks