PDA

View Full Version : addEventListener question


absolutezero3424
10-24-2007, 03:52 PM
When you use addEventListener functions, is there any way to add parameters to the function that is called? for example:





some_mc.addEventListener(Event.ENTER_FRAME, onEnterFrame);



function onEnterFrame(e:Event):void {

// some code...

}





is there any way to add parameters to the function "onEnterFrame" other than the event parameter? if so, how do you handle this? could you provide an example? Thx!

senocular
10-24-2007, 03:55 PM
The function passed into addEventListener is always called with one argument: the event object.

There are "workarounds" but they're just adding additional layers to the event listener (which is still only being called with one argument - it just becomes a matter of having that function call another function with the arguments you want).