Posted By

tuffstudio on 11/26/10


Tagged


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

tspitzr
onemanstudio
Leang
weavermedia
tombarc


AS3 right-click menu


 / Published in: ActionScript 3
 

  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  

You need to login to post a comment.