You get this kind of error when one of the listeners is expecting a
ResultEvent
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ricrootnc
Sent: Tuesday, January 15, 2008 10:44 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Type Coercion Issue with custom event
Just so it's clear... I've updated my custom event class as such:
package ads.events
{
import flash.events.Event;
import mx.rpc.events.ResultEvent;
public class AuthEvent extends Event
{
public static const AUTHSUCCESS:String
= 'authsuccess';
public static const AUTHFAILURE:String
= 'authfailure';
public var authResult:ResultEvent = null;
public function AuthEvent(type:String,
bubbles:Boolean=false, cancelable:Boolean=false,
authResult:ResultEvent=null)
{
super(type, bubbles, cancelable);
this.authResult = authResult;
}
override public function clone():Event
{
return new AuthEvent(type, false, false,
authResult);
}
}
}
When I step through this, everything is fine.. no problem actually
creating the event.
It's actually dispatching the event that generates the error...
TypeError: Error #1034: Type Coercion failed: cannot convert
ads.events::[EMAIL PROTECTED] to mx.rpc.events.ResultEvent.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at ads::LoginWindow/authByUsernameResult()
[C:\src\flexProjects\Components\ads\LoginWindow.mxml:83]
Rick