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";
}
The first four events worked fine, but I just added ILLEGALPOSITIONand tried this:
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 hit this stack with me when I hit the send 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], Window.as:457 - . , WTF flash.events.EventDispatcher.dispatchEventFunction MouseEvent?