Nothing wrong in principle.  These problems are hard to diagnose because
the call stack doesn't tell you who was about to receive the event.

 

Go look at your listeners to make sure they are defined with the correct
type.  Log all events you wrap and dispatch so you can see the name of
the event that caused the failure, then see who's listening and what
kind of event they expect.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Dominic Pazula
Sent: Wednesday, March 26, 2008 5:23 PM
To: [email protected]
Subject: [flexcoders] Re: Events and .dispatchEvent();

 

Hi Alex,
Thanks for the reply. I'm trying to figure out which of these two 
(or maybe both) apply in my case.

I have my singleton manager, whose implementation is defined as:
public class SASManagerImpl extends EventDispatcher implements 
ISASManager

I have a remote object with a listener defined for the 
FaultEvent.Fault. That listener function is:
private function handleFault(event:FaultEvent):void{
var smf:SASManagerFaultEvent = new SASManagerFaultEvent
(faultStr,event.bubbles,event.cancelable,event.fault,event.token,event
.message);

event.stopPropagation();
this.dispatchEvent(smf);
}

SASManagerFaultEvent extends FaultEvent and defines a few new 
constants (around the different remote calls I make).

Can you tell what I am doing wrong from this?

Also, if there is a good tutorial somewhere on this, please send it 
along. I have looked, but cannot find anything.

Thanks
Dominic

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Usually, this is an error in the metadata that describes which event
> class will be dispatched for a particular event, or an error in the 
code
> where the type of event in the parameter list of the listener 
function
> does not match the actual event sent.
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>

[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Dominic Pazula
> Sent: Wednesday, March 26, 2008 2:23 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Events and .dispatchEvent();
> 
> 
> 
> This is probably a real easy one.
> 
> I have a manager for my RPC processes that extends 
EventDispatcher. I
> have 2 custom events (fault and result) that extend the RPC 
ResultEvent
> and FaultEvent. I have listeners in the manager that catch the rpc
> events, use them to create my events, stopPropagation() on the RPC
> event, and then use this.dispatchEvent(myevent) to send my event 
along.
> 
> Sometimes this works. Sometimes it doesn't. I often get errors 
like
> the following:
> 
> TypeError: Error #1034: Type Coercion failed: cannot convert
> talonlib.events::[EMAIL PROTECTED] to 
mx.rpc.events.MyFaultEvent.
> 
> I'm sure I'm missing something somewhere? Can anyone see this off 
the
> top of their head, or know of a good resource to look into to learn 
more
> about this topic?
> 
> Thanks
> 
> Dominic
>

 

Reply via email to