for loop, duplicate movieclip, and getURL problem
Hi,
I have one movieclip which has onRelease function in the loop, but it isn't working for me properly. Maybe someone can help me with this.
Here is my code:
Actionscript Code:
var dataXML:XML = new XML();
dataXML.ignoreWhite = true;
var url:String = "";
dataXML.onLoad = function(success){
if(success){
var news:Array = dataXML.firstChild.firstChild.childNodes;
for (i = 0; i < 9; i++) {
url = news[i].childNodes[1].firstChild.nodeValue;
mc_url.duplicateMovieClip("mc_url_new"+i, i);
_root["mc_url_new"+i]._x = 170;
_root["mc_url_new"+i]._y=i*mc_url._height;
_root["mc_url_new"+i].onRelease = function(){
this.getURL(url);
}
trace(url);
}
}
else{
trace("didint load");
}
}
dataXML.load("data.xml");
Problem is, that all dynamically generated mc's have the same url which is the last in the xml file. But when I trace the code, all url's are loading successfully...
I was wondering, that it could be the mc's depth problem, because dynamically generated last mc has the highest depth, but I can't figure it out how to solve this problem anyway...