I am attaching movie clips to the stage according to how many items are in an XML list. Everything works fine, but when I click on the next button I want the attached clips to be removed. when using itemAdd.removeMovieClip(), it only removes the last one.
I have modified the code to:
var item_spacing = 40;
var item_count = 0;
function loadInfo(info_xml){
var info = info_xml.firstChild.childNodes;
for (var i=0; i<7; i++){
var itemAdd = attachMovie("holder_clip","holder_clip"+i, item_count);
itemAdd._y = 0;
itemAdd._x =(110)+(92*(i));
item_count++;
var TxtAdd = attachMovie("text_holders","text_holders"+i, item_count);
TxtAdd._y = 58;
TxtAdd._x = (125)+ (92*(i));
item_count++;
itemAdd.jpg_holder.loadMovie(info_xml.firstChild.childNodes*.childNodes,1);
TxtAdd.playedTxt = info_xml.firstChild.childNodes*.attributes.played;
TxtAdd.pointsTxt = info_xml.firstChild.childNodes*.attributes.points;
next_but.onRelease = function(){
for(var i=0; i<7;i++){
this["holder_clip"+i].removeMovieClip();
}
for (var z=7; z<14; z++){
var itemAdd2 = attachMovie("holder_clip","holder_clip"+z,item_count);
itemAdd2._y = 0;
itemAdd2._x =(-540)+(92*(z));
item_count++;
itemAdd2.jpg_holder.loadMovie(info_xml.firstChild.childNodes[z].childNodes,1);
}
}
}
}
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success){
if(success) loadInfo(this);
else trace("Error Loading")
}
my_xml.load("teams.xml");
stop();
using
for(var i=0; i<7;i++){
this["holder_clip"+i].removeMovieClip();
}
but it does not work. Any help would be greatly appreciated.