Check out the docs for the activate event - it goes all the way up the
chain to EventDispatcher/DisplayObject and is a broadcast event, which
means:

 

The DisplayObject class contains several broadcast events. Normally, the
target of any particular event is a specific DisplayObject instance. For
example, the target of an added event is the specific DisplayObject
instance that was added to the display list. Having a single target
restricts the placement of event listeners to that target and in some
cases the target's ancestors on the display list. With broadcast events,
however, the target is not a specific DisplayObject instance, but rather
all DisplayObject instances, including those that are not on the display
list. This means that you can add a listener to any DisplayObject
instance to listen for broadcast events. In addition to the broadcast
events listed in the DisplayObject class's Events table, the
DisplayObject class also inherits two broadcast events from the
EventDispatcher class: activate and deactivate .

 

I'd take that to mean that you shouldn't use "activate" or "deactivate"
(or any broadcast event names) for your custom events.  I was able to
replicate the 1034 using a custom "activate" event -- other names seemed
safe though, depending on what component your DateRangePicker is being
extended from.

 

HTH,

Ryan

From: [email protected] [mailto:[email protected]] On
Behalf Of Richard Rodseth
Sent: Tuesday, February 03, 2009 5:59 PM
To: [email protected]
Subject: Re: [flexcoders] Another 1034 - events and event types

 

Hi Jeff. Yes, my event classes do descend from Event. I've also run in
debug mode, but you don't get a 
stack crawl on the 1034. It just says "main thread". 

On Tue, Feb 3, 2009 at 4:54 PM, Jeffry Houser <[email protected]>
wrote:


 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: [email protected]
[mailto:[email protected]] On Behalf Of Richard Rodseth
        Sent: Tuesday, February 03, 2009 6:11 PM
        To: [email protected]
        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.DateRa
ngePickerEvent")]
            </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

 

 



This message is private and confidential. If you have received it in error, 
please notify the sender and remove it from your system.

Reply via email to