Deleting 'in function' listener with other function

Hello everybody.

I have a really annoying problem with removing eventListener created in public function, with another public function.

Is there a way to give a ‘name’ to a specific listener, to reference to it later on? Or maybe i can add listener to a array/dictionary?

Theres a code:


public function _c(target, posX:Number = 0, posY:Number = 0, autoUpdate:Boolean = true)
{		
	if(autoUpdate == true){
		thisStage.addEventListener(Event.RESIZE, exe);
           }
			
	else if(autoUpdate == false){
		thisStage.removeEventListener(Event.RESIZE, exe);
		trace("detach executed");
	}
			
	function exe()
           {
		target.x = (stageW - target.width)/2 + posX;
		target.y = (stageH - target.height)/2 + posY;
           }

			
	exe();
			
	// Assignments //
	target.attachment = _c;
	target.posX = posX;
	target.posY = posY;
}


/////     DETACH     /////
public function _detach(target)
{		
	target.attachment(target, target.posX, target.posY, false);
}



I am sure that ‘_detach’ function is working properly, because i get ‘detach executed’ output.

But, the listener added in 5th line doesn’t get removed, and i really don’t know why.
I am waiting for your help.

Thanks in advance