What's the best way to capture an event (i.e. button click) from a
custom component in a parent container. Would I want to have the button
click event call a handler in the component and then from the handler
dispatch a custom event or is there a better way? Here's some code to
help illustrate:
//CustomComponent
<mx:Script>
<![CDATA[
public function exitHandler(event:MouseEvent):void {
var myEventObj:Event = new Event( "myCustomEvent" );
dispatchEvent( myEventObj );
}
]]>
</mx:Script>
<mx:Metadata>
[ Event( name="myCustomEvent", type="flash.events.Event") ]
</mx:Metadata>
<mx:Button id="" label="Cancel" width="65" textAlign="center"
click="exitHandler()"/>
// End CustomComponent
// parent container (i.e. Application.mxml)
<mx:Script>
<![CDATA[
public function someEventHandler(event:MouseEvent):void {
// execute ....
}
]]>
</mx:Script>
<sx:CustomComponent myCustomEvent="someEventHandler()" />
Thanks for the assistance.