Flash 9 full-screen addChild error
I am having issues with Flash 9 player while in full-screen mode. In my case addChild method of DisplayObject behavior is wired while "Press Esc to exit full screen mode" is shown. There are no problem in normal stage mode or after "Press Esc.." message fades out. Flash 10 player does not have this problem.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" minWidth="955" minHeight="600">
<mx:Script>
<![CDATA[
protected function fullScreenButton_clickHandler(event:MouseEvent):void
{
stage.displayState = StageDisplayState.FULL_SCREEN;
}
protected function addButton_clickHandler(event:MouseEvent):void
{
var b:Button = new Button();
b.label="Button" + b.uid;;
body.addChildAt(b,0);
var child:DisplayObject = body.getChildAt(0);
trace(child);
}
]]>
</mx:Script>
<mx:VBox>
<mx:Button id="fullScreenButton" label="Full screen" click="fullScreenButton_clickHandler(event)"/>
<mx:Button id="addButton" label="Add" click="addButton_clickHandler(event)"/>
</mx:VBox>
<mx:VBox backgroundColor="#ffffff开发者_Python百科" id="body">
</mx:VBox>
I am trying to create new button and add it to body VBox using addChild method and getting runtime error on next Flex display validation when debugger is attached; without debugger full screen just exits and application left in unusable state (mouse is not working). This occurs when you press Add button when "Esc" message is displayed.
When error occurs debugger shows that child is mx.skins.halo.HaloBorder. In case without error child is mx.controls.Button.
Error:
TypeError: Error #1034: Type Coercion failed: cannot convert mx.skins.halo::HaloBorder@19c9869 to mx.core.IUIComponent.
at mx.containers.utilityClasses::BoxLayout/measure()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\containers\utilityClasses\BoxLayout.as:90]
at mx.containers::Box/measure()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\containers\Box.as:276]
at mx.core::UIComponent/measureSizes()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5967]
at mx.core::UIComponent/validateSize()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5913]
at mx.core::Container/validateSize()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\Container.as:2702]
at mx.managers::LayoutManager/validateSize()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:579]
at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:692]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8744]
at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8684]
Anyone have an idea how to workaround this issue or why does it happens?
精彩评论