数据网格中带有标题窗口的上下文菜单

3

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

[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事件中调用标题窗口的初始化函数。

请帮忙!!


在添加代码时,请选择它并按Ctrl + K。此外,整洁规范的代码将会得到更好的答案。 - gideon
1个回答

1

我也遇到了这个问题。为了让它在我的项目中正常工作,我不得不明确地在TitleWindow上设置这两个属性:

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接