ok, this is bugging me… I can’t figure out what I’m doing wrong. :crying:
:drool: briefly:
I’ve got a function wich is invoked onPress and loads content into an image gallery. no problem as for that: there’s a loop that goes and checks how many images the xml file refers to, creates an empty movie clip for each and assigns the respective image to it.
thing is: if I press another button that refers to another set of images to be loaded, the function has to remove the clips wich held the previous set of images, otherwise, if the new image set is shorter than the previous one, the images in excess will still be displayed; to make it clearer: if set “one”'s got 4 pics, and set “two”'s got 6 pics, after I’ve loaded set “two”, if I load set “one” the gallery displays set “one”'s pics 1,2,3,4 and set “two”'s pics 5 and 6;
I tryed to use the removeMovieClip(); method the following way, but I can’t get it to work:
function placingImages(gobledigook){
//xml node with images
var allImages = gobledigook.childNodes[2].childNodes;
//removing images
for (i=0; i<j.length; i++){
_root.pathToLocation_mc.removeMovieClip("slideItem"+i, i);
trace("removed slideItem" + i);
}
//placing images
for (j = 0; j<allImages.length; j++) {
//picks up the images in the xml file
var currentImage = allImages[j].firstChild.nodeValue;
//creates a clip (slideItem) to hold each image
var slideItem = _root.pathToLocation_mc.createEmptyMovieClip("slideItem"+j, j);
trace("created "+slideItem._name);
//slideItem's width plus spacing
slideItem._x = j*285;
//assigns each image to each slideItem
slideItem.loadMovie(currentImage);
}
}
:hangover: it don’t remove no darn friggin’ nuttin’ that there code! I can’t figure out what the hell is the wrong with it! supposedly, I’m doing everything by the book, so it should work.
furthermore,
trace(“removed slideItem” + i); displays:
removed slideItem0
removed slideItem1
removed slideItem2
…
trace("created "+slideItem._name); displays:
created slideItem0
created slideItem1
created slideItem2
…
and in the right proportion, so technically, the proper instances are being passed to the method, right?
ideas, anyone?