在 flex 中的右键单击上下文菜单中隐藏默认选项
我正在开发一个 flex 应用程序,我想为它添加一个上下文菜单.我用这个代码得到了它:
I'm developing a flex application and I want to add it a context menu. I got it with this code:
var myMenu:ContextMenu = new ContextMenu();
myMenu.hideBuiltInItems();
var defaultItems:ContextMenuBuiltInItems = myMenu.builtInItems;
defaultItems.print = false;
var item:ContextMenuItem = new ContextMenuItem("Go to google");
myMenu.customItems.push(item);
item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
this.contextMenu = myMenu;
但是我有一个问题.菜单显示四个默认选项(设置、关于闪存...)我想隐藏它们.使用 defaultItems.print = false;我隐藏了打印选项,但我不知道如何隐藏其他选项.有人知道怎么做吗?谢谢.
But I have a problem. The menu shows four default options (Settings, about flash...) I would like to hide them. With defaultItems.print = false; I hid the print option, but I don't know how to hide others. Does anybody know how to do that? Thanks.
作为 ContextMenu 说,
您无法删除设置"菜单上下文菜单中的项目.这设置菜单项是必需的Flash,以便用户可以访问影响隐私和的设置存储在他们的计算机上.你也无法删除关于菜单项,这是必需的,以便用户可以找出 Flash Player 的版本他们正在使用.
You cannot remove the Settings menu item from the context menu. The Settings menu item is required in Flash so that users can access the settings that affect privacy and storage on their computers. You also cannot remove the About menu item, which is required so that users can find out what version of Flash Player they are using.
因此,您只需要使用 Settings
和 About
项即可.对于其他默认项目,请参阅 ContextMenuBuiltInItems 的参考.
So you'll just have to live with the Settings
and About
items. For other default items, see the reference for ContextMenuBuiltInItems.