Flex上下文菜单不显示所有项目

yb3bgrhw  于 2022-09-21  发布在  Apache
关注(0)|答案(1)|浏览(181)

我为我的应用程序创建了一个上下文菜单。

if (!contextMenu) 
            {
                contextMenu = new ContextMenu();
            }

            contextMenu.hideBuiltInItems();
            contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT,onContextMenuSelected);

            _cmiEdit=new ContextMenuItem("Ändern");
            _cmiEdit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,onContextMenuItemSelected);

            _cmiDelete=new ContextMenuItem("Löschen");
            _cmiDelete.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,onContextMenuItemSelected);

            contextMenu.customItems.push(_cmiEdit,_cmiDelete);

在应用程序中,只有第一个上下文菜单项目可见,我不知道为什么?在《空中》中,两者都被展示出来。FlashPlayer11.8版

pbossiut

pbossiut1#

这似乎是Flex的一个错误!我试着用另一个菜单项“äber das Programm”来开始您的代码。新的物品出现了!然后我试着用“OE”来改变Löschen中的“ö”,结果奏效了!

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" 
           minWidth="955" minHeight="600" creationComplete="init(event)">

<fx:Script>
    <![CDATA[
        import mx.events.FlexEvent;

        protected function init(event:FlexEvent):void
        {
            var _cmiEdit:ContextMenuItem;
            var _cmiDelete:ContextMenuItem;
            var _cmiAbout:ContextMenuItem;

            if (!contextMenu) 
            {
                contextMenu = new ContextMenu();
            }

            contextMenu.hideBuiltInItems();
            contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, onContextMenuSelected);

            _cmiEdit = new ContextMenuItem("Ändern");
            _cmiEdit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenuItemSelected);

            _cmiDelete=new ContextMenuItem("Loeschen");
            _cmiDelete.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenuItemSelected);

            _cmiAbout=new ContextMenuItem("Über das Programm");
            _cmiAbout.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenuItemSelected);

            contextMenu.customItems.push(_cmiEdit, _cmiDelete, _cmiAbout);
        }

        protected function onContextMenuSelected(evt:ContextMenuEvent):void
        {

        }

        protected function onContextMenuItemSelected(evt:ContextMenuEvent):void
        {

        }

    ]]>
</fx:Script>

</s:Application>

相关问题