When calling the function to remove the event listener my application crashes and get the error:
Uncaught exception - Invalid field access : removeEventListener
Not sure if I am doing something wrong or is this is a problem with openFL. This is a sample of my code.:
class Main extends Sprite {
public var backgroundsprite:Sprite;
public function new () {
addChild(backgroundsprite);
backgroundsprite.addEventListener((MouseEvent.MOUSE_UP, clicked);
}
.......
//some function that calls the removeeventlistener
private function disablelisteners():Void{
trace('Disable listeners');
backgroundsprite.removeEventListener(MouseEvent.MOUSE_UP, clicked);
}
}