Tips: How To Customize Right-click Menu In ActionScript 3

apple-menu-icon Somebody who read Replace the Flex’s Default Right Click Menu asked how to do the same with Flash AS3. In fact, AS3 provides the class named ContextMenu to controls the menu, and classes that handle the ContextMenuItem properties and ContextMenuEvent events.

The following is part description of ContextMenu class, you can get more details on Adobe Livedocs.

The ContextMenu class provides control over the items in the Flash Player context menu. Users open the context menu by right-clicking (Windows) or Control-clicking (Macintosh) Flash Player. You can use the methods and properties of the ContextMenu class to add custom menu items, control the display of the built-in context menu items (for example, Zoom In and Print), or create copies of menus.

I built a simple fla, which add two items on the top. Here is live demo( Right click pls )

How To Customize Right-click Menu In ActionScript 3

Here is AS3 source code:

var menuItem1:ContextMenuItem = new ContextMenuItem("Welcome to");
var menuItem2:ContextMenuItem = new ContextMenuItem("Contact Us");
var myMenu:ContextMenu = new ContextMenu();
contextMenu = myMenu;
function reg(e:ContextMenuEvent) {
var tagetURL:URLRequest = new URLRequest("");
function F(e:ContextMenuEvent) {
var tagetURL:URLRequest = new URLRequest("");
Share and Enjoy:
  • Digg
  • Facebook
  • Google Bookmarks
  • DZone
  • Reddit
  • Technorati
  • StumbleUpon
  • Twitter
RSS Enjoy this Post? Subscribe to

RSS Feed   RSS Feed     Email Feed  Email Feed Follow us Follow us
You can leave a response, or trackback from your own site.

Leave a Reply