Assuming the following pattern:
someObjectInstance.addEventListener(MyDisplayObject.EVENT_CONSTANT, _handleMyEvent);
private function _handleMyEvent( event:Event = null ):void
{
// Event handler logic...
}
If I wanted to add a required parameter to the handler function am I able to do this and still use a "generic" event and event listener? Or am I correct in assuming that I need to create a custom event class that has the parameter in it and reference that through the event object passed into the handler function?
To phrase this another way... If I have a handler function that looks like this:
private function _handleMyEvent( data:Object, event:Event = null ):void
{
if (data == null)
{
return;
}
// Event handler logic...
}
Then what does the addEventListener function need to look like? Is there a more advanced syntax? Is there a way to do this with closures?
Looking for a clear code example and/or documentation reference. Just trying to understand if I absolutely have to override the generic Event class in this scenario.