在flex中右键单击上下文菜单中隐藏默认选项

前端之家收集整理的这篇文章主要介绍了在flex中右键单击上下文菜单中隐藏默认选项前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在开发一个flex应用程序,我想添加一个上下文菜单.我用这段代码得到了它:
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;我隐藏了打印选项,但我不知道如何隐藏其他选项.
有谁知道怎么做?
谢谢.

解决方法

正如 ContextMenu的参考说的那样,

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.

所以你只需要使用“设置”和“关于”项目.有关其他默认项目,请参阅ContextMenuBuiltInItems的参考.

猜你在找的Flex相关文章