Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex Type Coercion, it's gone mental I think
    text
    copied!<p>I have a class essentially:</p> <pre><code>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 } </code></pre> <p>The first four events were working fine, but I just I added <code>ILLEGALPOSITION</code> and tried this:</p> <pre><code> // 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.")); } } </code></pre> <p>So Flex spewed this stack at me when I hit the dispatch method:</p> <pre>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> <p>As you can see from the trace, <code>Window.as:<strong>457</strong></code> is the last user code line. So WTF is <code>flash.events.EventDispatcher.dispatchEventFunction</code> trying to do with a <code>MouseEvent</code>?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload