# Remove listeners with an array

**URL:** https://forum.kirupa.com/t/remove-listeners-with-an-array/322240
**Category:** Uncategorized
**Created:** [May 15, 2011, 11:27pm UTC](https://forum.kirupa.com/t/remove-listeners-with-an-array/322240 "2011-05-15T23:27:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bonassus](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bonassus](https://forum.kirupa.com/u/bonassus)
#### Post date: [May 15, 2011, 11:27pm UTC](https://forum.kirupa.com/t/remove-listeners-with-an-array/322240/1 "2011-05-15T23:27:09Z")

</div>

I’m trying to remove all the event listeners from nextBtn. the names of all the possable callback functions are stored in mdpArray. I want to use the for loop to remove all the listeners from nextBtn.  
the error message says

cannot convert “mdp1\_1” to Function

How can i make this work.

Thank you for your help.

```auto
var mdpArray:Array = ["mdp1_1","mdp1_2","mdp1_3","mdp1_4","mdp1_5"];

private function clearEvents(nextBtn):void{
var _nextBtn = nextBtn;
for(var i:Number = 0; i<mdpArray.length; i++){ _nextBtn.removeEventListener(MouseEvent.CLICK,mdpArray*);
}
}

```
