Flash 9全屏addChild错误

时间:2011-02-10 14:53:14

标签: flash flex fullscreen addchild

我在全屏模式下遇到Flash 9播放器问题。在我的情况下,显示DisplayObject行为的addChild方法,同时显示“按Esc退出全屏模式”。在正常阶段模式或“按Esc ..”消息淡出后没有问题。 Flash 10播放器没有这个问题。

<?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" id="body">
    </mx:VBox>

我正在尝试使用addChild方法创建新按钮并将其添加到body VBox,并在附加调试器时在下一个Flex显示验证时获取运行时错误;没有调试器全屏只退出和应用程序处于不可用状态(鼠标不工作)。当显示“Esc”消息时按“添加”按钮时会发生这种情况。

发生错误时,调试器会显示该子项为mx.skins.halo.HaloBorder。在没有错误的情况下,child是mx.controls.Button。

错误:

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]

任何人都知道如何解决此问题或为什么会发生这种情况?

0 个答案:

没有答案