On 3/11/06, Jason Y. Kwong <[EMAIL PROTECTED]> wrote:
> My custom component broadcasts an event called "move". So I declare it in
> the MXML:
>
> <mx:Metadata>
> [Event(name="move", type="flash.events.Event")]
> </mx:Metadata>
>
> And then later dispatch it:
>
> dispatchEvent(new Event("move"));
>
> But I get a runtime error when dispatching:
>
> Type Coercion failed: cannot convert flash.events::[EMAIL PROTECTED] to
> mx.events.MoveEvent
If you're extending UIComponent, you already have a "move" event
declared to be of type mx.events.MoveEvent. The MXML compiler
generates an event handler that accepts an argument of type
mx.events.MoveEvent. So now when you pass it an object that is not a
MoveEvent (i.e. flash.events.Event), you get a runtime error.
I think the MXML compiler should give an error if the same event is
repeated in a subclass with an incompatible type.
Manish
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/