Given that your compiler error concerns converting a HelpEvent to a MouseEvent,my guess would be that the problem is that the listener which is receiving your HelpEvent event expects to receive a MouseEvent. This is a piece of code which you have not yet shown us: i.e. the listener function for the HelpEvent.
--- In flexcoders@yahoogroups.com, "Jason" <[EMAIL PROTECTED]> wrote: > > So I have a simple component which is a help button, (the component > is mainly just an image.) I wrote a custom event (extends Event) for > use all over my app when a help event occurs, like a request to > launch help. I want to just dispatch this custom event when my > custom help button is clicked, so this is my setup: > > in the script tag: > > import myPackage.blahblahblah.event.HelpEvent; > > private function onHelpClicked():void > { > dispatchEvent(new HelpEvent(HelpEvent.HELP_INITIALIZED, true)); > } > > then later in the MXML: > > <help:HelpButton click="onHelpClicked()" /> > > But the problem is, I get a runtime error when the component is > clicked, "Type Coercion failed: cannot convert > com.venice.event::[EMAIL PROTECTED] to flash.events.MouseEvent." > > If I don't dispatch my custom event, it runs fine. > > Why and how can I fix this? I just want to dispatch a custom event > when the component is clicked on. > > Also, one thing I have never understood about mixing MXML and > Actionscript, is why, when you assign a method to run when something > is clicked on, you don't do this: > > <mx:Script> > <![CDATA[ > private function onMyButtonClick(event:MouseEvent):void > { > //do stuff > } > ]]> > </mx:Script> > <mx:Button click="onMyButtonClick()"/> > > Why don't you put in (event:MouseEvent) as an argument for that > method like you do with other handlers in Actionscript, but not when > the method is called from MXML? > > Thanks > > Jason >