Details
Description
Steps to reproduce:
1. compile the component bellow:
<?xml version="1.0" encoding="utf-8"?>
<s:NavigatorContent xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="400"
height="300"
creationComplete="navigatorcontent1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.events.ValidationResultEvent;
protected function navigatorcontent1_creationCompleteHandler(event:FlexEvent):void
{ dispatchEvent(new ValidationResultEvent(ValidationResultEvent.INVALID)); } ]]
>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:NavigatorContent>
2. add it in a ViewStack
3. Run the application in AIR
Actual Results: Error -
[SWF] MainWindow.swf - 5,579,465 bytes after decompression
TypeError: Error #1034: Type Coercion failed: cannot convert mx.events::ValidationResultEvent@ece6fc9 to mx.events.FlexEvent.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:12266]
at br.com.revelacaovirtual.envelope::NavigatorTest/navigatorcontent1_creationCompleteHandler()[D:\FlexWorkspace\RVClientFlexLib\src\br\com\revelacaovirtual\envelope\NavigatorTest.mxml:14]
at br.com.revelacaovirtual.envelope::NavigatorTest/___NavigatorTest_NavigatorContent1_creationComplete()[D:\FlexWorkspace\RVClientFlexLib\src\br\com\revelacaovirtual\envelope\NavigatorTest.mxml:7]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:12266]
at mx.core::UIComponent/set initialized()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1577]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:759]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]
Expected Results: No error
Workaround (if any): The error happens in
override public function dispatchEvent(event:Event):Boolean
From UIComponent, in super.dispatchEvent(event). Once It´s not possible see the method in superclass, I could not make a deep investigation. It seems the method want a FlexEvent instead of an Event, the super class of ValidationResultEvent. Maybe just changing the superclass could sover the issue.