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");