带有标题窗口的datagrid中的contextmenu

时间:2011-12-26 07:31:45

标签: flex contextmenu

我想在标题窗口中添加一个带有数据网格的上下文菜单,添加后没有任何反应。

[Bindable]      
public var cm:ContextMenu;

private function init(event:FlexEvent):void
{        
 var cmi:ContextMenuItem = new ContextMenuItem("View item...", true);   
 cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
                                           ontextMenuItem_menuItemSelect);    
 cm = new ContextMenu();                    
 cm.hideBuiltInItems(); 
 cm.customItems = [cmi];
} 

我在标题窗口creationComplete事件上调用init函数。

请帮助!!

1 个答案:

答案 0 :(得分:1)

刚刚遇到过这个问题。为了让它适用于我的项目,我必须在TitleWindow上明确设置这两个:

// "this" being the TitleWindow. Doing this during creation complete event.
this.mouseEnabled = true;
this.skin.mouseEnabled = true;