The basic procedure is to
Form Context Menu
You are not allowed to assign a context menu to the stage (though the help file says you can) - I tried, it produces an error.
As shown below, just create a new context menu and then assign it to the application variable. (Notice that the first *c* is capitalized in one case and not the other.)
contextMenu = new ContextMenu; |
Adding *About*
var FMenuItem : ContextMenuItem = new ContextMenuItem("About xyz version 1.0...");
FMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuHandler);
contextMenu = new ContextMenu;
contextMenu.hideBuiltInItems();
contextMenu.customItems.push(FMenuItem);
var FLink: String = "http://mc-computing.com/WebTools/Generic_mcGraph/Overview.html";
public function menuHandler(event:ContextMenuEvent):void {
var urlReq:URLRequest = new URLRequest(FLink);
navigateToURL(urlReq, "_blank");
}
|
Note - navigateToURL fails when opening a web page locally (normal security setting), but works fine when the swf file is read from a server. It also works when running inside the Flash CS3 IDE.
Author: Robert Clemenzi - clemenzi@cpcug.org