Flex Type Coercion, I think this is spiritual

I basically have a class:

public class WindowEvent extends Event
{
public static const WARNEVENT:String = "warnEvent";
public static const TASKREQEVENT:String = "taskRequestEvent";
public static const TASKANNOUNCE:String = "taskAnnounce";
public static const WINDOWCHANGE: String = "windowChange";
public static const ILLEGALPOSITION:String = "illegalPosition";

// insert brevity
}

The first four events work Normal, but I just added ILLEGALPOSITION and tried this:

// inside Window.as
private function checkDimensions():void {
if (!Window._legalBoundaryEnable)
return;
... var pass:Boolean = Window.legalBoundary.containsRect(
455 this.getBounds(stage));
456 if( !pass) {
457 this.dispatchEvent(new WindowEvent(WindowEvent.ILLEGALPOSITION,
... "Illegal Position etc."));
}
}

So when I click on the scheduling method , Flex will send me this stack:

TypeError: Error #1034: Type Coercion failed: cannot convert ¬
flex.utils.ui::WindowEvent@511dce41 to flash.events.MouseEvent.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent () ¬
[C:\autobuild\~\UIComponent.as:9298]
at flex.utils.ui::Window/checkDimensions()[C:\Users\~\Window.as: 457]
at flex.utils.ui::Window/stageResized()[C:\Users\~\Window.as:220]

As you can see from the trace, Window.as : 457 is the last user code line. So WTF is flash.events.EventDispatcher.dispatchEventFunction try to use MouseEvent?

This error usually occurs because the listener you set has incorrect event parameter types . I’m pretty sure this must be the case.

Check all the listeners you set for this event and make sure that the function is

someFunction(event: WindowEvent): void

I basically have a lesson:

public class WindowEvent extends Event
{
public static const WARNEVENT:String = "warnEvent";
public static const TASKREQEVENT:String = "taskRequestEvent";
public static const TASKANNOUNCE:String = "taskAnnounce";
public static const WINDOWCHANGE:String = "windowChange";
public static const ILLEGALPOSITION:String = "illegalPosition";

// insert brevity
}

The first four events are working fine, but I just added ILLEGALPOSITION and tried this:

// inside Window.as
private function checkDimensions():void {
if(!Window._legalBoundaryEnable)
return;
... var pass:Boolean = Window.legalBoundary.containsRect(
455 this. getBounds(stage));456 if(!pass) {
457 this.dispatchEvent(new WindowEvent(WindowEvent.ILLEGALPOSITION,
... "Illegal Position etc."));
}
}

So when I click on the dispatch method, Flex will send me this stack:

TypeError: Error #1034: Type Coercion failed: cannot convert ¬
flex.utils.ui::WindowEvent@511dce41 to flash.events.MouseEvent.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/ dispatchEvent()
at mx.core::UIComponent/dispatchEvent() ¬
[C:\autobuild\~\UIComponent.as:9298]
at flex.utils.ui::Window /checkDimensions()[C:\Users\~\Window.as:457]
at flex.utils.ui::Window/stageResized()[C:\Users\~\Window.as:220]< /pre>

As can be seen from the trace, Window.as: 457 is the last user code line. So WTF is flash.events.EventDispatcher.dispatchEventFunction try to use MouseEvent?

This error usually occurs because the listener you set has an incorrect event parameter type. I'm pretty sure this must be the case. < p>

Check all the listeners you have set for this event and make sure that the function

someFunction(event: WindowEvent): void

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5836 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.