Forums  

Go Back   Forums > Talk > General FPP Discussion

Reply
 
Thread Tools Display Modes
  #1  
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

Hi

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);
removeDefaultItems();
addCustomMenuItems();
this.contextMenu = myContextMenu;

}

function removeDefaultItems():void
{
myContextMenu.hideBuiltInItems();

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

function addCustomMenuItems():void
{
var item:ContextMenuItem = new ContextMenuItem("Copyright www.panoramas.ch");
myContextMenu.customItems.push(item);
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)
{
event.target.customItems[1].enabled = true; // show full screen button
event.target.customItems[2].enabled = false; // hide normal screen button
}
else
{
event.target.customItems[1].enabled = false; // hide full screen button
event.target.customItems[2].enabled = true; // shoe normal screen button
}
}

ContextMenuItemExample();

Regards Markus
Reply With Quote
Reply

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 12:19 PM.


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