# Nested mc control

**URL:** <https://forum.kirupa.com/t/nested-mc-control/319565>\
**Category:** flash\
**Created:** [February 24, 2011, 6:27pm UTC](https://forum.kirupa.com/t/nested-mc-control/319565 "2011-02-24T18:27:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pop30](https://avatars.discourse-cdn.com/v4/letter/p/8797f3/32.png) [@pop30](https://forum.kirupa.com/u/pop30)\
**Post date:** [February 24, 2011, 6:27pm UTC](https://forum.kirupa.com/t/nested-mc-control/319565/1 "2011-02-24T18:27:00Z")

</div>

I have on stage one mc which is the main menu called menu.  
In this mc I have another mc which is the submenu sub\_menu.  
By clicking on items in the submenu I place mc’s from the library on stage  
with stage.addChild(name\_of\_mc)

How can I remove these mc’s from stage if I click on the menu mc ?  
removeChild needs to know the name of the child but this depend on de mc putted on stage in mc sub\_menu

in mc sub\_menu :

function fn\_people\_click(event:MouseEvent):void{  
var mc\_com2:peoples = new peoples(); //clip in lib met classname peoples  
mc\_com2.x= 150;  
mc\_com2.y= 110;  
stage.addChild(mc\_com2); //there are 17 different mc’s that can be on stage - the controling mc menu does not know which mc is on stage  
}

in mc menu :

function remove\_pages(event:MouseEvent) :void{  
stage.removeChild(0); // I want to remove the mc putted on stage by sub\_menu  
}

So :

mc sub\_menu puts a mc on stage  
mc Menu has to remove this mc  
mc Menu does not know which mc sub\_menu had put on stage
