Adding Parameters to addEventListener

February 20, 2009 by jared 

Here’s how you can easily add parameters to an event listener in AS3.

stage.addEventListener(MouseEvent.CLICK,
	function(e : MouseEvent) : void
	{
		fMyFunction(e, "hello world")
	},
	false , 0 , false);

function fMyFunction(e : MouseEvent, vMsg:String) : void
{
	trace(vMsg);
}

flash file logo Click here to download the sample.