I’ve been looking for a long time, but I cannot find anything on removing dynamically added movie clips. I really need to remove these movie clips dynamically since they are being placed by xml and I can never be sure how many clips will be added. Here is my code:
function callText(e:MouseEvent):void{
for (var k:Number = 0; k < my_total; k++){
var words_url = myXML.list[k].@videotitle;
var textRollDwn:ThumbText_mc = new ThumbText_mc();
galContainer.addChild(textRollDwn);
textRollDwn.name = "textRollDwn" + k;
textRollDwn.x = k%3*200;
textRollDwn.y = Math.floor(k/3)*150;
textRollDwn.words_txt.text = words_url;
textRollDwn.alpha = 50;
btnArray.push(textRollDwn)
}
}
Now this code works but I’m trying to write a function that when I roll off of this movieclip it goes away. I pushed them into an array thinking that I could also make them go away, but they wont. I tried:
for (var m:Number = 0; m < my_total; m++){
galContainer.removeChild(btnArray[m])
}
with this i get: The supplied DisplayObject must be a child of the caller
and this:
for (car m:Number = 0; m < my_total; m++){
galContainer.removeChild(["textRollDwn"] + m)
}
I get a type coercion failer saying that flash can’t convert “textRollDwn0” to flash.display.DisplayObject. But that’s what I named the movie clips…according to the name property anyway!
Thanks for help in advanced! Gosh I need it…