AS3 right-click menu


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var myMenu:ContextMenu = new ContextMenu();
  2. myMenu.hideBuiltInItems();
  3. var menuItem1:ContextMenuItem = new ContextMenuItem("Hello World");
  4. var menuItem2:ContextMenuItem = new ContextMenuItem("Go to My Page");
  5. menuItem2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doSomething);
  6. myMenu.customItems.push(menuItem1);
  7. this.contextMenu = myMenu;
  8.  
  9. function doSomething(e:ContextMenuEvent):void
  10. {
  11. var url:String = "http://www.kennylin.com";
  12. var request:URLRequest = new URLRequest(url);
  13. navigateToURL(request, '_blank');
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.