# Closing a movie clip with EventListener with a mouse click

**URL:** <https://forum.kirupa.com/t/closing-a-movie-clip-with-eventlistener-with-a-mouse-click/328345>\
**Category:** Uncategorized\
**Created:** [May 9, 2012, 9:43pm UTC](https://forum.kirupa.com/t/closing-a-movie-clip-with-eventlistener-with-a-mouse-click/328345 "2012-05-09T21:43:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![good\_snow](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@good\_snow](https://forum.kirupa.com/u/good_snow)\
**Post date:** [May 9, 2012, 9:43pm UTC](https://forum.kirupa.com/t/closing-a-movie-clip-with-eventlistener-with-a-mouse-click/328345/1 "2012-05-09T21:43:13Z")

</div>

I have a button that loads a movie clip and I want to be able to close that same movieclip by clicking anywhere. The first part works and will open the mc but I need help with the second part to click anywhere and to close the mc.

This is my script so far:

var newBio = new BioToc();  
btn\_2.addEventListener(MouseEvent.CLICK, goBio);

function goBio (e:MouseEvent):void {  
this.addChild(newBio);  
newBio.x = 25; newBio.y = 45;

function removeMC (e:MouseEvent):void {  
removeChild(newBio);  
stage.removeEventListener(MouseEvent.CLICK,removeMC);  
btn\_2.addEventListener(MouseEvent.CLICK, goBio);  
}  
}
