# RemoveEventListener Not Working?

**URL:** <https://forum.kirupa.com/t/removeeventlistener-not-working/329196>\
**Category:** flash\
**Created:** [July 30, 2012, 9:33pm UTC](https://forum.kirupa.com/t/removeeventlistener-not-working/329196 "2012-07-30T21:33:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarkTingson](https://avatars.discourse-cdn.com/v4/letter/m/c77e96/32.png) [@MarkTingson](https://forum.kirupa.com/u/MarkTingson)\
**Post date:** [July 30, 2012, 9:33pm UTC](https://forum.kirupa.com/t/removeeventlistener-not-working/329196/1 "2012-07-30T21:33:29Z")

</div>

Hi Everyone,

I am working on function that rewinds a movieclip’s timeline when I bumped into a situation wherein my EnterFrame event doesn’t get destroyed. Below is my code:

```auto
[FONT=courier new]function rewindTo(frame:Number, mc:MovieClip):void {[/FONT]
[FONT=courier new] var destinationFrame = frame;[/FONT]
[FONT=courier new] mc.prevFrame();[/FONT]
[FONT=courier new] if (mc.currentFrame == destinationFrame) {[/FONT]
[FONT=courier new] trace("--")[/FONT]
[FONT=courier new] my_mc.removeEventListener(Event.ENTER_FRAME, function(e:Event){ rewindTo(1, my_mc ) });[/FONT]
[FONT=courier new] [/FONT]
[FONT=courier new] }[/FONT]
[FONT=courier new]}[/FONT]
[FONT=courier new]my_mc.addEventListener(Event.ENTER_FRAME, function(e:Event){ rewindTo(1, my_mc ) });[/FONT]

```

Notice that I check if my EnterFrame event has been destroyed by using a trace function. But for some reasons, it keeps on tracing even though I’m calling the removeEventListener method.

Am I missing something here guys?

Thanks in advance,  
Mark
