Hi Shirish I read your reply and found it useful. I also found a link which has detailed example of using clone() method. Here is the link http://shashankkulkarni.com/2010/03/30/how-clone-method-works-and-why-to-write-it/
On Sun, Feb 12, 2012 at 7:18 AM, Shishir Vaghela <[email protected]>wrote: > Hello Nitin, > > If you are required to *redispatch *your *CustomEvent* using * > dispatchEvent(event) *in an handler that is handling the *event, *you > need to override the *clone()* method. > > When the *CustomEvent* is redispatched, the event framework behind the > scenes will call the *clone()* method of *CustomEvent* (if overridden) > else it will call the *clone()* method of base class *flash.events.** > Event.* > Now, clone() method of *Event* will return the object of type *Event *instead > of *CustomEvent, *which will cause the object to truncate any additional > information that was added to *CustomEvent*. > Also, the handler for your redispatched event will be expecting an object > of type *CustomEvent*, which will now get an object of type *Event *(returned > by *clone()* method)*.* This will cause a *Type Coercion Failed* error > stating that it cannot convert *flash.events.Event* to your *CustomEvent*type > *.* > There won't be any runtime error if your handler for redispatched event is > expecting an object of *flash.event.Event* type instead of *CustomEvent, *but > your additional *CustomEvent* properties will be lost. > * > * > * > * > Regards > Shishir > > > On Fri, Feb 10, 2012 at 12:35 PM, Nitin Gopi <[email protected]> wrote: > >> Hi All >> I am using cairngorm framework in my project. I do not override the >> clone() method in the event class. In fact I never use it whenever I create >> a custom event class. The application works fine. >> But in the flex docs it is written that overriding clone() is necessary >> when we are creating a custom event. Can somebody clarify on this. >> >> With Regards, >> Nitin Gopi >> >> -- >> You can only depend on yourself. The cavalry ain't coming. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Flex India Community" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/flex_india?hl=en. >> > > > -- > You received this message because you are subscribed to the Google Groups > "Flex India Community" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/flex_india?hl=en. > -- You can only depend on yourself. The cavalry ain't coming. -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.

