[flexcoders] Re: Type Coercion Issue with custom event

2008-01-15 Thread ricrootnc
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



RE: [flexcoders] Re: Type Coercion Issue with custom event

2008-01-15 Thread Alex Harui
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

 



Re: [flexcoders] Re: Type Coercion Issue with custom event

2008-01-15 Thread Rick Root
 On 1/15/08, Alex Harui [EMAIL PROTECTED] wrote:
 You get this kind of error when one of the listeners is expecting a
ResultEvent

Thanks Alex.. I finally figured it out and was just coming back here to
post.

You are correct.. one of my listeners was listening for a ResultEvent... too
bad FlexBuilder couldn't tell me that.

At least now I'll remember to consider that if this comes up again!

Rick

-- 
Rick Root
New Brian Vander Ark Album, songs in the music player and cool behind the
scenes video at www.myspace.com/brianvanderark