Context Menu

import flash.net.URLRequest;

import flash.ui.ContextMenu;



var menu:ContextMenu = new ContextMenu();

var credit:ContextMenuItem = new ContextMenuItem( "Created by Johnny" );

var site:ContextMenuItem = new ContextMenuItem( "Vist my web-site" );



credit.addEventListener( ContextMenuEvent.MENU_ITEM_SELECT, visit_johnny );

site.addEventListener( ContextMenuEvent.MENU_ITEM_SELECT, visit_johnny );

/*site.separatorBefore = false;*/



menu.hideBuiltInItems();

menu.customItems.push(credit, site);

this.contextMenu = menu;



function visit_johnny(e:Event){

	var johnny_link:URLRequest = new URLRequest( "http://www2.hawaii.edu/~johnbarr" );

	navigateToURL( johnny_link, "_parent" );

}

By | 2009-03-15T19:58:44+00:00 March 15th, 2009|Actionscript 3.0, Flash|0 Comments

About the Author:

Leave A Comment