Flash 9全屏addChild错误

发布于 2024-10-16 17:07:20 字数 2901 浏览 2 评论 0原文

我在全屏模式下使用 Flash 9 播放器时遇到问题。在我的例子中,显示对象行为的 addChild 方法已连接,同时显示“按 Esc 退出全屏模式”。在正常舞台模式下或“Press 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 方法将其添加到主体 VBox,并在附加调试器时在下一个 Flex 显示验证中出现运行时错误;如果没有调试器,全屏只会退出,并且应用程序处于不可用状态(鼠标无法工作)。当显示“Esc”消息时按添加按钮时会发生这种情况。

发生错误时,调试器显示子项是 mx.skins.halo.HaloBorder。如果没有错误,子项是 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]

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

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" 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文