Passing Variables to EventListeners in AS 3
March 6th, 2009
Instead of using anonymous functions we can write something like this to access variables from within eventListeners:
private classVar:String = 'A string just for fun';
private function myClassFunction():void{
var FunctionVar:String = 'A string just for fun';
var myHandler:Function = function(e:Event):void{
classVar = 'Something else';
FunctionVar = 'Something else';
trace('----Event.CLOSE-----');
pslnote.removeEventListener(Event.CLOSE, myhandler);
pslnote = null;
return;
}//handlerEnd
pslnote.addEventListener(Event.CLOSE,myHandler);
}//functionEnd










