I have a class essentially:
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 were working fine, but I just I 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 Flex spewed this stack at me when I hit the dispatch method:
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
trying to do with a MouseEvent
?