How do I remove child from a different Timeline. One of my movieclip contains three children. I want to remove all the three children. How could I do that. I tried setting instance name and removing the instances using getChildByName. But it doesn’t seem to work.
var mainMc:MovieClip = new MovieClip();
addChild(mainMc);
var box:box_mc;
var objLength:int;
for (var i:int = 0; i<3; i++) {
box= new box_mc;
mainMc.addChild(box);
box.x=i*100;
box.name="box"+i;
objLength=i;
}
remove_mc.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void {
for (var i:int=0; i<=objLength; i++) {
mainMc.removeChild(getChildByName("box"+i));
}
}