【问题标题】:NativeMenu not appearing on WindowsNativeMenu 未出现在 Windows 上
【发布时间】:2014-12-06 22:37:15
【问题描述】:

我觉得问这个问题很愚蠢,但我花了 2 个多小时试图解决这个问题,但没有任何乐趣。

我只是想在 Windows 上显示一些本机菜单。我编写了自己的代码,并且可以在 OSX 上运行,但 Windows 上没有出现菜单,所以我四处搜索示例广告已经测试了六个,包括 this one from Adobe.

我所做的并没有什么特别之处。 NativeWindow 系统 chrome 是标准的,等等。我在运行 VMWare 的 OSX 和 Windows 7 上对此进行了测试——但大多数事情似乎都可以正常工作。我输入了一个跟踪语句,表明菜单是在 Windows 上创建的。

有谁知道什么可以阻止在 Windows 上的 Flex WindowAplication 中创建菜单?

        private function initMenu():void
        {
            if( NativeWindow.supportsMenu){
                stage.nativeWindow.menu = createAppMenu();
            } else if( NativeApplication.supportsMenu ){
             NativeApplication.nativeApplication.menu = createAppMenu();
            }
        }


        private function createAppMenu():NativeMenu
        {
            var myMenu:NativeMenu = new NativeMenu();

            var nameMenu:NativeMenuItem = myMenu.addItem( new NativeMenuItem( "Window World" ) );
            var aboutMenu:NativeMenu = new NativeMenu();
            var aboutMenuItem:NativeMenuItem = aboutMenu.addItem( new NativeMenuItem( "About" ) );
            nameMenu.submenu = aboutMenu;

            var fileMenu:NativeMenuItem = myMenu.addItem( new NativeMenuItem( "File" ) );
            fileMenu.submenu = buildFileMenu();

            return myMenu;
        }

        private function buildFileMenu():NativeMenu
        {
            var fileMenu:NativeMenu = new NativeMenu();
            var closeAppMenu:NativeMenuItem = fileMenu.addItem( new NativeMenuItem( "Exit" ));
            closeAppMenu.addEventListener( Event.SELECT , closeApp );
            return fileMenu;
        }

【问题讨论】:

    标签: actionscript-3 apache-flex air flex4


    【解决方案1】:

    Flex 的整个过程太烦人了……

    菜单没有显示的原因是因为我使用了creationComplete 事件。切换到windowComplete 是正确的事件。

    <s:WindowedApplication 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="1024" height="768" 
                           showStatusBar="false"
                           windowComplete="initMenu(this)" >
    

    【讨论】:

      猜你喜欢
      • 2021-11-23
      • 1970-01-01
      • 1970-01-01
      • 2017-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多