Right Click Menu in ActionScript 3 tagged:

Right Click Menu in ActionScript 3

Posted by admin in ActionScript 3, Flash

It is pretty easy to make a custom right click menu or context menu in Flash ActionScript 3. You may try and adapt below source codes for your projects.

Actionscript:
  1. import flash.net.URLRequest;
  2. import flash.ui.ContextMenu;
  3.  
  4. var fm_menu:ContextMenu = new ContextMenu();
  5. var copyright:ContextMenuItem = new ContextMenuItem( “Copyright © flashmo.com” );
  6. var credit:ContextMenuItem = new ContextMenuItem( “Free Flash Templates” );
  7.  
  8. copyright.addEventListener( ContextMenuEvent.MENU_ITEM_SELECT, visit_flashmo );
  9. credit.addEventListener( ContextMenuEvent.MENU_ITEM_SELECT, visit_flashmo );
  10. credit.separatorBefore = false;
  11.  
  12. fm_menu.hideBuiltInItems();
  13. fm_menu.customItems.push(copyright, credit);
  14. this.contextMenu = fm_menu;
  15.  
  16. function visit_flashmo(e:Event)
  17. {
  18. var flashmo_link:URLRequest = new URLRequest( “http://www.flashmo.com” );
  19. navigateToURL( flashmo_link, “_parent” );
  20. }

Download Source File