Go Back   Forums > Talk > General FPP Discussion

Thread Tools Display Modes
Old 11-01-2007, 04:43 PM
marktold marktold is offline
Junior Member
Join Date: Oct 2007
Posts: 18
Downloads: 0
Uploads: 0
Default Customizing Context Menu


I want to add cutomItems to the rightClick Menu.

Enter Fullscreen, Exit Fullscreen, Copyright and stuff.

I need to know if it is possible to access the players context menu from another file.

This would be the working code in my context_menu.swf file.

I need to replace this line

this.contextMenu = myContextMenu;

stage.contextMenu = myContextMenu; did not work :???:


import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;
import flash.ui.ContextMenuBuiltInItems;
import flash.display.Sprite;
import flash.text.TextField;

var myContextMenu:ContextMenu;

function ContextMenuItemExample()
myContextMenu = new ContextMenu();
myContextMenu.addEventListener(ContextMenuEvent.ME NU_SELECT, onContextMenuHandler);
this.contextMenu = myContextMenu;


function removeDefaultItems():void

var defaultItems:ContextMenuBuiltInItems = myContextMenu.builtInItems;
defaultItems.print = true;

function addCustomMenuItems():void
var item:ContextMenuItem = new ContextMenuItem("Copyright");
var fs:ContextMenuItem = new ContextMenuItem("Show Full Screen" );
fs.addEventListener(ContextMenuEvent.MENU_ITEM_SEL ECT, onShowFullScreen);
myContextMenu.customItems.push( fs );
var xfs:ContextMenuItem = new ContextMenuItem("Exit Full Screen");
xfs.addEventListener(ContextMenuEvent.MENU_ITEM_SE LECT, onShowNormalScreen);
myContextMenu.customItems.push( xfs );
function onShowFullScreen(event:ContextMenuEvent):void
stage.displayState = StageDisplayState.FULL_SCREEN;
function onShowNormalScreen(event:ContextMenuEvent):void
stage.displayState = StageDisplayState.NORMAL;
function onContextMenuHandler(event:ContextMenuEvent):void
if (stage.displayState == StageDisplayState.NORMAL)
{[1].enabled = true; // show full screen button[2].enabled = false; // hide normal screen button
{[1].enabled = false; // hide full screen button[2].enabled = true; // shoe normal screen button


Regards Markus
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT. The time now is 05:27 AM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.