A single event class being used for multiple events is common within the Flex Framework; why recommend not re-using the same type?
Back to the problem:
Are you sure that your event class extends flash.events.Event ? I might expect odd errors if not. Have you tried running the code in debug mode to see what is going on; maybe isolate the line which causing the error.
Tracy Spratt wrote:

I would not use the same type name.

Tracy Spratt
Lariat Services

Flex development bandwidth available

------------------------------------------------------------------------

*From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Richard Rodseth
*Sent:* Tuesday, February 03, 2009 6:11 PM
*To:* flexcoders@yahoogroups.com
*Subject:* [flexcoders] Another 1034 - events and event types

I have a few MXML components that provide reusable pickers for things like date ranges. I also nest these components. Is it OK to reuse event types like "change" and "activate", but associated with different event classes?
For that matter must an event type always be associated with one class?

I dispatching non-bubbling events from these components, and set up the meta-info as expected:

    <mx:Metadata>
[Event(name="activate",type="com.companyname.appname.event.picker.DateRangePickerEvent")]
    </mx:Metadata>

and use them like this:

    <picker:DateRangePicker
        activate="onActivateDateRangePicker(event)"
        />

I'm occasionally getting an error  like this:

TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::ev...@f4130d1 to com.companyname.appname.event.picker.DateRangePickerEvent.

Who would be trying to cast an event to my type? Changing the event type to "activatePicker" seems to be helping, but I'd rather not have a proliferation.

--

Flexcoders Mailing List


--
Jeffry Houser, Technical Entrepreneur
Adobe Community Expert: http://tinyurl.com/684b5h
http://www.twitter.com/reboog711  | Phone: 203-379-0773
--
Easy to use Interface Components for Flex Developers
http://www.flextras.com.com?c=104
--
http://www.theflexshow.com
http://www.jeffryhouser.com
--
Part of the DotComIt Brain Trust

Reply via email to