/ Published in: ActionScript 3

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var myMenu:ContextMenu = new ContextMenu(); myMenu.hideBuiltInItems(); var menuItem1:ContextMenuItem = new ContextMenuItem("Hello World"); var menuItem2:ContextMenuItem = new ContextMenuItem("Go to My Page"); menuItem2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doSomething); myMenu.customItems.push(menuItem1); this.contextMenu = myMenu; function doSomething(e:ContextMenuEvent):void { var url:String = "http://www.kennylin.com"; var request:URLRequest = new URLRequest(url); navigateToURL(request, '_blank'); }
Comments
