# How do I Removie an EventListeners after a button has been pressed?

**URL:** https://forum.kirupa.com/t/how-do-i-removie-an-eventlisteners-after-a-button-has-been-pressed/314963
**Category:** Uncategorized
**Created:** [October 13, 2010, 2:21pm UTC](https://forum.kirupa.com/t/how-do-i-removie-an-eventlisteners-after-a-button-has-been-pressed/314963 "2010-10-13T14:21:48Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ALX1084](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@ALX1084](https://forum.kirupa.com/u/ALX1084)
#### Post date: [October 13, 2010, 2:21pm UTC](https://forum.kirupa.com/t/how-do-i-removie-an-eventlisteners-after-a-button-has-been-pressed/314963/1 "2010-10-13T14:21:48Z")

</div>

I’m trying to remove an EventListener after I click on a button. The thing is that I have the AS calling a movieclip, which is calling a box to appear on the stage.  
The code that I have works, but if you keep clicking on that same button more than once more boxes keep appearing one on top of the other one, so what i need is to remove the listener when you click on the button ones, but if i click on a different button to activate the listener again so that i can click on that same button again and make the box appear. so here’s what i got so far:

function Main() {

// Adding mouse event to our stage!  
b1.addEventListener(MouseEvent.CLICK, AddBox);

}  
Main();

function AddBox(e:MouseEvent):void {

// Adding a box to the stage  
var newBox:AbUsbox = new AbUsbox();  
this.addChild(newBox);

// Setting the box’s X and Y position  
newBox.x = 883.15;  
newBox.y = 420.75;

// Setting the box’s scale and alpha  
newBox.scaleX = 1;  
newBox.scaleY = 1;  
newBox.alpha = 1;  
}
