removeEventListener function will nicht

Good morning!
I am at daggers drawn with the following.


function onMouseclick(e:MouseEvent):void {
	if(e.target == buttonHome) {
		var noEventListener:Array =  new Array("buttonFolioDraft", "buttonFolioPhot", "buttonFolio2",
		disattachEventListener(buttonArray, noEventListener);
	}
}

and:

function disattachEventListener(array:Array, filter:Array):void {
/** Remove EventListener from all elements of an Array that names are matching one
of the filter Strings **/
	var disattach:Array = new Array();
	for(var i:uint = 0; i < array.length; i++) {
		
		for(var j:uint = 0; j < filter.length; j++) {
			
			if(array*.name.substring(0, filter[j].length) == filter[j]) {
				trace("yuppy!");
				disattach.push(array*);
			}
		}
	}
	
	for(var i:uint = 0; i < disattach.length; i++) {
			
			disattach*.removeEventListener(MouseEvent.ROLL_OVER, setActiveWindow(), false);
			disattach*.removeEventListener(MouseEvent.ROLL_OUT, setActiveWindow());
			disattach*.removeEventListener(MouseEvent.CLICK, setActiveWindow());
			disattach*.buttonMode = false;
	}
}

function setActiveWindow():void {
// just empty atm
	trace("here: ActiveWindow");
}

The output gives me the following:

TypeError: Error #2007: Parameter listener must be non-null.
at flash.events::EventDispatcher/removeEventListener()
at 09_fla::MainTimeline/disattachEventListener()
at 09_fla::MainTimeline/onMouseclick()

Since I am completely sure I added to each of those MCs each three EventListener, I checked out EventDispatcher in the API lang. ref. for removeEventlistener but no matter beeing unsure I understood what the third parameter now really achieves, I tried both states with the same result.
Best regards,
zoimt

There’s a bracket missing from the way you’ve declared your noEventListener array. (I’m assuming that’s just the way you’ve cut and paste your code.)

I’m also assuming those ‘yuppy’ traces are appearing no problem.

What happens if you use ‘setActiveWindow’ instead of ‘setActiveWindow()’ ?

ie

[COLOR=#000000][COLOR=#007700]for(var [/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]:[/COLOR][COLOR=#0000bb]uint [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]0[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]i [/COLOR][COLOR=#007700]< [/COLOR][COLOR=#0000bb]disattach[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]length[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]++) { 
             
            [/COLOR][COLOR=#0000bb]disattach[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#0000bb]removeEventListener[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]MouseEvent[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]ROLL_OVER[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]setActiveWindow[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]false[/COLOR][COLOR=#007700]); 
            [/COLOR][COLOR=#0000bb]disattach[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#0000bb]removeEventListener[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]MouseEvent[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]ROLL_OUT[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]setActiveWindow[/COLOR][COLOR=#007700]); 
            [/COLOR][COLOR=#0000bb]disattach[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#0000bb]removeEventListener[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]MouseEvent[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]CLICK[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]setActiveWindow[/COLOR][COLOR=#007700]); 
            [/COLOR][COLOR=#0000bb]disattach[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#0000bb]buttonMode [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]false[/COLOR][COLOR=#007700]; 
    } [/COLOR][/COLOR]

instead of

[COLOR=#000000][COLOR=#007700]for(var [/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]:[/COLOR][COLOR=#0000bb]uint [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]0[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]i [/COLOR][COLOR=#007700]< [/COLOR][COLOR=#0000bb]disattach[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]length[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]++) { 
             
            [/COLOR][COLOR=#0000bb]disattach[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#0000bb]removeEventListener[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]MouseEvent[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]ROLL_OVER[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]setActiveWindow[/COLOR][COLOR=#007700](), [/COLOR][COLOR=#0000bb]false[/COLOR][COLOR=#007700]); 
            [/COLOR][COLOR=#0000bb]disattach[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#0000bb]removeEventListener[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]MouseEvent[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]ROLL_OUT[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]setActiveWindow[/COLOR][COLOR=#007700]()); 
            [/COLOR][COLOR=#0000bb]disattach[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#0000bb]removeEventListener[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]MouseEvent[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]CLICK[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]setActiveWindow[/COLOR][COLOR=#007700]()); 
            [/COLOR][COLOR=#0000bb]disattach[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000bb]i[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#0000bb]buttonMode [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]false[/COLOR][COLOR=#007700]; 
    } [/COLOR][/COLOR]

if want avoid error "must be non-null "
code tester


if (disattach* != null) disattach*.removeEventListener(MouseEvent.ROLL_OVER, setActiveWindow, false);

Thanks for replying.
@ DiamondDog: Yes it was a copy paste error, my bad. The source actually goes like:

var noEL:Array =  new Array("buttonFolioDraft", "buttonFolioPhot", "buttonFolio2",
							"buttonFolio3");

Anyway, the other hints didnt help, either, just added the if (disattach* != null) line to the code and tried to call the function witout () but I still get following error when executing:
TypeError: Error #2007: Parameter listener must be non-null.
at flash.events::EventDispatcher/removeEventListener()
at 09_fla::MainTimeline/disattachEventListener()
at 09_fla::MainTimeline/onMouseclick()

So what i came up with was that this is not working because one of the Strings nested in the filter array might be longer than the actual name of one of the elements inside the other array (array:Array… hm in this case it is a confusing variable name^^) but it still gives me that sh**.
Maybe I have to go for a different approach.