removeEventListener not working

I’m having problems with the removeEventListener function; it doesn’t do anything for some reason.
Here are some snippets of my code (the things that were cut out can’t have anything to do with this since they don’t get called or anything when this problem occurs):

class ProjectileWeapon extends Sprite
public function new() 
	y = Global.elementSize * 2;
    graphics.drawRect(0, 0, 0.8 * Global.elementSize, 0.8 * Global.elementSize);
	this.addEventListener(Event.ENTER_FRAME, update);


public function remove():Void {
	this.removeEventListener(Event.ENTER_FRAME, update);

For some reason, when calling the remove function, the instance gets removed, but the eventListener stays right where it is. Using Google, I found out that in flash removing an eventListener only works in the same function as the addEventListener, and I’m compiling to flash. Using the same function for both doesn’t work with me, but maybe this problem is similar?

Ah, apparantly this flash problem actually was my problem, I just implemented it in the wrong way. Fixed now :slight_smile:

Can you post your solution? I am wondering if I am encountering the same issue. In my case removing an event listener crashes my application.

It’s been a year ago since I posted this, I have no clue anymore what my solution was… Sorry!

Sorry I noticed it was a year ago after I had posted.