# AS3 removing Dynamically Created Event Listener

**URL:** <https://forum.kirupa.com/t/as3-removing-dynamically-created-event-listener/319166>\
**Category:** flash\
**Created:** [February 10, 2011, 5:37pm UTC](https://forum.kirupa.com/t/as3-removing-dynamically-created-event-listener/319166 "2011-02-10T17:37:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pjbruce](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@pjbruce](https://forum.kirupa.com/u/pjbruce)\
**Post date:** [February 10, 2011, 5:37pm UTC](https://forum.kirupa.com/t/as3-removing-dynamically-created-event-listener/319166/1 "2011-02-10T17:37:13Z")

</div>

Hi Guys,

This is something I really need to crack - not just to solve the problem but understand the issue.

I’ve dynamically created event listeners in the usual sort of way:

```auto

myText.addEventListener(MouseEvent.MOUSE_OVER, hover(nameLabel));
function hover(nameLabel):Function
{
	var createHover:Function = function (evt:MouseEvent):void 
	{
		getChildByName(nameLabel).filters = [myFilter1];
	}
	return createHover;
}

```

The problem is how to remove the event listener later in the program as the usual code isn’t working. I’m guessing I should have done this in a class but I’d like to understand this problem better.

Any guru’s out there care to share some insight? :hugegrin:

(I hate not understanding things - you’re not really learning…)
