Flex做的添加右键菜单及页面跳转事件。
var myContextMenu : ContextMenu = new ContextMenu();
var GoUrl : ContextMenuItem = new ContextMenuItem("铁芒网博,欢迎您!");
GoUrl.addEventListener(ContextMenuEvent.MENU_ITEM_Select,GoUrlClick);
myContextMenu.customItems.push(GoUrl);
myContextMenu.hideBuiltInItems();
this.contextMenu = myContextMenu;
private function GoUrlClick(event:ContextMenuEvent):void
{
navigateToURL(new URLRequest("http://www.techmango.com/blog/ViewStory.asp"),"_blank");
}
发现在Flex所用的页面跳转方法跟flash的不一样,flash中是这样用的:
getUrl("http://www.techmango.com/blog/ViewStory.asp","_blank");
var myContextMenu : ContextMenu = new ContextMenu();
var GoUrl : ContextMenuItem = new ContextMenuItem("铁芒网博,欢迎您!");
GoUrl.addEventListener(ContextMenuEvent.MENU_ITEM_Select,GoUrlClick);
myContextMenu.customItems.push(GoUrl);
myContextMenu.hideBuiltInItems();
this.contextMenu = myContextMenu;
private function GoUrlClick(event:ContextMenuEvent):void
{
navigateToURL(new URLRequest("http://www.techmango.com/blog/ViewStory.asp"),"_blank");
}
发现在Flex所用的页面跳转方法跟flash的不一样,flash中是这样用的:
getUrl("http://www.techmango.com/blog/ViewStory.asp","_blank");
本文介绍如何使用Flex创建自定义右键菜单,并实现点击菜单项进行页面跳转的功能。通过实例代码展示了添加菜单项及绑定点击事件的具体步骤。

388

被折叠的 条评论
为什么被折叠?



