var myContextMenu:ContextMenu = new ContextMenu();
var mAuthor:ContextMenuItem = new ContextMenuItem("关于自己");
myContextMenu.customItems.push(mAuthor);
var mPage:ContextMenuItem = new ContextMenuItem("我的主页",true);
myContextMenu.hideBuiltInItems();
myContextMenu.customItems.push(mPage);
this.contextMenu = myContextMenu;
mAuthor.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, itemSelectHandler);
mPage.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, itemSelectHandlerII);
function itemSelectHandler(e:ContextMenuEvent):void {
trace("关于自己对应的函数");
}
function itemSelectHandlerII(e:ContextMenuEvent):void {
trace("我的主页对应的函数");
}
|