Return to Snippet

Revision: 11826
at February 20, 2009 11:32 by Bonky


Initial Code
import flash.display.Sprite;
import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;
import flash.events.ContextMenuEvent;
import flash.net.navigateToURL;
import flash.net.URLRequest;

var menuItemLabel:String = "©2009 Foo Co.";
var url:String = "http://www.foo.com";
var cm:ContextMenu;


cm = new ContextMenu();
cm.hideBuiltInItems();
var cmi:ContextMenuItem = new ContextMenuItem(menuItemLabel);
cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelected);
cm.customItems.push(cmi);
this.contextMenu = cm;


function menuItemSelected(evt:ContextMenuEvent):void {
	var req:URLRequest = new URLRequest(url);
	navigateToURL(req, '_blank');
}

Initial URL
http://snipplr.com/favorites/Bonky/

Initial Description

                                

Initial Title
Contextual Menu with Link

Initial Tags

                                

Initial Language
ActionScript 3