This content has been marked as final. Show 5 replies
From that link:
If you define an event listener inline (inside the MXML tag), you can add any number of parameters as long as the listener function's signature agrees with that number of parameters.
If you add a listener with the addEventListener() method (in ActionScript), you cannot pass any additional parameters to the listener function, and that listener function can declare only a single argument, the Event object (or one of its subclasses).
To pass additional parameters to listener functions defined in AS, you must define the parameters in the listener function and then call some other method passing it the additional parameters in the call from the listener.
You can also define your own custom events, and then you are free to define what args your event listeners take, and access the data from the event object.
"seRajan" <firstname.lastname@example.org> wrote in message
> In MXML
> <mx:Button click="clickHandler();" mouseDown="downHandler(event);"
> mouseOver="overHandler(btn);" mouseMove="moveHandler('RAJAN');"/>
> but AS3
> var btn:Button = new Button();
> btn.addEventListener(MouseEvent.CLICK, clickHandler, flase, 0, true);
> only this kind of AS3 event only added, any other possibility to pass the
> arguments to handler function.
Usually you only need to get target or currentTarget, because 99 times out
of 100, the information you need is available as a property from that
So the question becomes are you looking to pass additional information with the event, or simply to access information already in the event object.