# RemoveChild from its own class

**URL:** <https://forum.kirupa.com/t/removechild-from-its-own-class/331817>\
**Category:** Uncategorized\
**Created:** [October 29, 2013, 11:30pm UTC](https://forum.kirupa.com/t/removechild-from-its-own-class/331817 "2013-10-29T23:30:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nightkarnation](https://avatars.discourse-cdn.com/v4/letter/n/a5b964/32.png) [@nightkarnation](https://forum.kirupa.com/u/nightkarnation)\
**Post date:** [October 29, 2013, 11:30pm UTC](https://forum.kirupa.com/t/removechild-from-its-own-class/331817/1 "2013-10-29T23:30:58Z")

</div>

Hey guys! Here’s a noob question…

Simplified example: I have the following main.as

```auto

var mcPopUp:McPopUp = new McPopUp(); //correctly exported to actionscript with its own class...
addChild(mcPopUp);

```

McPopUp has its own class called McPopUp

McPopUp.as

```auto

public function McPopUp() {
trace("Working...mc is being shown on stage and this trace is traced correctly");
mcClosePopUp.addEventListener(MouseEvent.CLICK, onClosePopUp); //mcClosePopUp is another mc Inside mcPopUp, when being clicked...it should remove from stage the mcPopUp
}
        
function onClosePopUp(event:MouseEvent)
{
removeChild(this); //<-- this is not working...
}

```

Any ideas?  
Thanks a lot!!
