ContextMenu With Icons
Hi, i have created a context menu in AS 3.0 Flex, but i cannot find the way to add icon to the left of single item.
ActionScript Code: public var contMenu:ContextMenu = new ContextMenu();public var contactMenuItemDel:ContextMenuItem = new ContextMenuItem("Voice 1");public var contactMenuItemMod:ContextMenuItem = new ContextMenuItem("Voice 2", true);contMenu.customItems.push(contactMenuItemDel);contMenu.customItems.push(contactMenuItemMod);
Is it possible add icons?
thanks marcus
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 10-30-2008, 06:04 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Right Clicking A SWF And Icons In ContextMenu
Is there any support for right clicking, other than the ContextMenu/ContextMenuItem functions to modify the default right click menu? Can I add right click support anywhere else in my SWF? Somehow I doubt it.
In the ContextMenu/ContextMenuItem functions mentioned above, can you somehow create icons next to the menu items you add to the right click context menu? Again, not sure it is supported.
Any thoughts on a work around or support for either would be helpful.
[F8] Replacing Scrolling Icons To Rotating World Icons
Hi,
I'm working on this web site that needs to be changed. What I want to do is replace the scroll menu with a rotting world menu. Kinda like Itunes has in the album view.
I have a function called mover that makes the scroll menu move. So what I was thinking was that all I have to do is adjust that function.
This is roating world that I want to add:
Code:
function mover(count){
if(inited){
world.rotateY(360- ((360/15) * id), 8);
}
}
and this is the old scrollling menu
Code:
function mover()
{
if(_ymouse > 250 && _ymouse < 365)
{
var xdist = _xmouse - Stage.width/2;
this._x -= xdist / 25;
}
else
{
if(_xmouse > centerX)
{
this._x -= speed;
}
else
{
this._x += speed;
}
}
if (this._x>= -600)
{
this._x = -1500;
}
if (this._x<= -1501)
{
this._x = -601;
}
}
My question is why can't I just call the new function mover so that it grabs that information now?
Thanks in advance,
Bmcc
Help With ContextMenu
Hi everyone.
I've a contextMenu instance. Call it my_cMenu.
If I assign it to a clip that is on the same timeline
myclip.menu=my_cMenu;
it works perfectly.
But if try to do the same thing with a nested clip
myclip.nested_clip.menu=my_cMenu;
it doesn't work.
Could anyone please help me?
Thanks,
Mariano
Contextmenu?
hi, i cant find any usefully info on disabling certain parts of the context menu?
how do i get rid of play,loop,100%,rewind,farward,back,print
fscommand("rewind", "false"); ?
cheers
ContextMenu
OK this is the MOST annoying thing ever !!
Firstly I needed to use a context menu , but IT HAS NO SUBMENU support
Secondly no nested movieclip support !
And thirdly it cannot be removed AT ALL
So now i was hoping not to list a 4th here...which is..HOW do i put something ON TOP of the context menu... So basically what i`m trying to do is emulate my OWN menu but it should be drawn ABOVE the [context menu that cannot be removed AT ALL]
i have this code to detect the right click and add the NEW MENU at mouse location...but still context menu covers it...HELP !!
ActionScript Code:
_level0.onEnterFrame = function()
{
var KEYVAL_right = 2;
if (Key.isDown(KEYVAL_right))
{
//place menu at mouse x/y
test._x = _root._xmouse;
test._y = _root._ymouse;
}
};
ContextMenu
I used to use this script to disable items on the contextmenu. How can I do the same in using ActionScript 3.0
//This code stops right mouse clicking to change flash settings in AS2.0
var my_cm:ContextMenu = new ContextMenu();
my_cm.hideBuiltInItems();
this.menu = my_cm;
ContextMenu
is there any way to make a cascading/nested menu entry like
Quality from MM ? (it has 3 options low medium high)
why in hell do MM not give control about this to the user ???
ContextMenu In ContextMenu?
i was wondering if i can include a ContextMenu item in another ContextMenu rather then a ContextMenuItem. the ideea is to make menu items with subitems.
i tried this code but obviously it doesn't work.. is there a way to do the subitems thing?
Code:
//the right click menu
var mycm:ContextMenu = new ContextMenu();
mycm.hideBuiltInItems();
//the menu sitems
var prop:ContextMenuItem = new ContextMenuItem("Properties",showProperties,true,true,true);
var refreshB:ContextMenuItem = new ContextMenuItem("Refresh",paint,true,true,true);
var arrange:ContextMenu = new ContextMenu();
var arrangeName:ContextMenuItem = new ContextMenuItem("Arrange by Name",arrangeByName,false,true,true);
var arrangeModified:ContextMenuItem = new ContextMenuItem("Arrange by Date",arrangeByDate,false,true,true);
arrange.customItems.push(arrangeName,arrangeModified);
//ading menu items to menu
mycm.customItems.push(arrange,refreshB,prop);
//actually setting menu
pivot.menu = mycm;
Using ContextMenu
hello guys!
well, i was trying to make a contextMenu. and everything was working fine till i had more than 15 items (contextMenu doesnt support) in the menu
since i needed to build my menu each time i click it, i used the onSelect function to build it, brolem was the same, once i push it inside, i could not remove him.
Right now, the only solution i can see is, when i invoke my function i need to clear all the contextmenu content and build it again without having to make a new contextmenu (tried that but was only working on the 2x right click)
its there a way to clean all my contextMenu array and make him again?
i was to be possble to, when i click, look for variables and contruct my menu.
ContextMenu; Help Me PLEASE ;()
Hi All,
I am trying to add a function to the ContextMenu; I wanted to run a function so that when the entry is clicked it takes the user to another website. I am using a separte document class aswell, but my code should work, but it don't so far. Thus far here is my code, that receives an error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at ScoposElite/frame1()
Please find the code attached, any help would be greatly appreciated. ;)
Kind Regards,
Boxing Boom
Attach Code
//Code: function for directing to purchase page through ContextMenu
var link2:URLRequest = new URLRequest("http://www.adobe.com");
myContextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, purchase);
function purchase(event:ContextMenuEvent):void
{
navigateToURL(link2);
}
//ContextMenu Begin Here
var myContextMenu:ContextMenu;
myContextMenu = new ContextMenu();
myContextMenu.hideBuiltInItems();
this.contextMenu = myContextMenu;
var item1:ContextMenuItem = new ContextMenuItem("::::::MYWIDGET::::::");
myContextMenu.customItems.push(item1);
item2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, purchase);
var item2:ContextMenuItem = new ContextMenuItem("Purchase MYWIDET", purchase, true);
myContextMenu.customItems.push(item2);
var item3:ContextMenuItem = new ContextMenuItem("Copyright 2008. COMPANY", true);
myContextMenu.customItems.push(item3);
Edited: 03/13/2008 at 07:05:17 AM by Boxing Boom
ContextMenu Help
Can someone please help me with the right code for just showing the about and a dimmed out settings in the ContextMenu for AS 3.0 and FlashPlayer 9. I am using this code and nothing seems to work.
var newMenu:ContextMenu = new ContextMenu();
newMenu.hideBuiltInItems();
ContextMenu();
I need to know how to make a sub-menu for a flash context menu. I have tried to create a menu item that is a meun in itself, but it wouldn't work. If anyone can help me with this, it would help.
ContextMenu();
I need to know how to make a sub-menu for a flash context menu. I have tried to create a menu item that is a meun in itself, but it wouldn't work. If anyone can help me with this, it would help.
[AS3] ContextMenu And ID
I am building a ContextMenu class that pulls its info from an array. All is working well, but I am having problems with how to give each item an id number for the MENU_ITEM_SELECT?
As you can see in my _onMenuItem... method I cannot have "i" but I need it to correspond to the correct item.
addCustomItems method
ActionScript Code:
private function _addCustomItems():void
{
for(var i:int = 0; i < Constants.CONTEXT_MENU.length; i++)
{
_contextMenuItem = new ContextMenuItem(Constants.CONTEXT_MENU[i].LABEL);
_contextMenu.customItems.push(_contextMenuItem);
_contextMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, _onMenuItemSelected , false, 0, true);
}
_onMenuItemSelected method
ActionScript Code:
private function _onMenuItemSelected($evt:ContextMenuEvent):void
{
navigateToURL(new URLRequest(Constants.CONTEXT_MENU[i].URL));
}
ContextMenu Question
are ContextMenus only available on clips directly on the main timeline? im trying to get some to work inside another movie clip
e.g. clip1.childClip.menu = myContextMenu;
and its not working at all,
clip1.menu = myContextMenu; works just fine, but, anything inside of that doesnt, is there something else i need to do or what?
ContextMenu On Sub-movie?
I'm trying to work with ContextMenu's and I've hit a snag. I can successfully add it to a specific movie (i.e. "outerMovie") but if "outerMovie" has a sub-movie called "innerMovie", how can I attach the menu to that? Is it possible? here's my code (which works - for the outerMovie):
Code:
tileMenu = new ContextMenu();
tileMenu.hideBuiltInItems();
tileMenu.customItems.push(new ContextMenuItem("Hello", showSomething));
outerMovie.menu=tileMenu;
function showSomething() {
trace("hello");
}
But if I choose:
Code:
outerMovie.innerMovie.menu=tileMenu;
...I get nothing. Any thoughts? Thanks for the help!
-Logrey
Contextmenu Disable
How do I disable the contextmenu, i.e. when the user rightclicks a textfield.
ExternalInterface & ContextMenu Bug
Steps to reproduce bug:
1. I use ExternalInterface.callback to receive browser scrollbar event notification & values, to scroll a scrollRect.y value. This works fine until...
2. I right-click for Flash ContextMenu (custom, or DefaultRemoved).
3. Try scrolling browser scrollbar
Results: The ExternalInterface.callback doesnt receive constant updates, only when the scrollbar is released. So the scrollRect.y value is only updated once I let go of the browser scrollbar.
Expected results:The same functions as before the right-click ContextMenu is triggered.
Problems_cm = New ContextMenu();
I need to know how to make a sub-menu for a flash context menu. I have tried to create a menu item that is a menu in itself, but it wouldn't work. If anyone can help me with this, it would help.
Contextmenu Class - Bug?
I'm using the class with multiple swfs, when i load swf's to upper levels the menu doesnt change, only in some areas it does, any ideas of how to call the class so it will be valid in all levels?
Thanks.
Contextmenu Council...
Hi !
It is possible to create a menu in the contextmenu making it possible to create a window (component…) ?
example:
function tab()
{
}
//CREATE FUNCTION FOR THE FIRST URL
function url1()
{
getURL("mailto:info@youremailaddress.com");
}
//CREATE FUNCTION FOR THE SECOND URL
function url2()
{
win = mx.managers.PopUpManager.createPopUp(this, mx.containers.Window, true,{_name: "myWin", _x:00, _y:00, _width:560, _height:320, closeButton:true, title:"Welcome", contentPath:"mymenu.swf"})
closeWin = new Object();
closeWin.click = function(){
win.deletePopUp();
}
win.addEventListener("click", closeWin);
}
var expand = new ContextMenu();
expand.hideBuiltInItems();
var $tab1 = new ContextMenuItem("Welcome ", tab, false, false, true);
var $tab2 = new ContextMenuItem("My window component", tab, false, false, true);
expand.customItems.push($tab1, $tab2);
expand.onSelect = menuHandler;
_root.menu = expand;
This code does not go but is 'it possible to do it?
Thank you for your help
ContextMenu Problem
Hai all,
in my flash file the context menu is not working..
Code:
function mySpin()
{
webwasp.gotoAndPlay(2);
} // End of the function
var myContextMenu = new ContextMenu();
myContextMenu.hideBuiltInItems();
var spin = new ContextMenuItem("Spin Spin Spin!!!", mySpin);
myContextMenu.customItems.push(spin);
webwasp.menu = myContextMenu;
i am using this code...
is there any publishing property should i change for that?
pls help me...
ContextMenu Issue
Hey guys,
I've built myself a working ContextMenu, which when tested in the Flash IDE works perfectly fine, and when tested in a browser (as the swf file).
However, when loading it in through SWFObject and some PHP the context menu no longer has custom items.
Any thoughts?
ContextMenu Problem
I have custom context menu for each different class. When i load my UI the custom context menu associated with each object is created as desired. Once i switch views, which results in deleting the current object instances by assigning null and creating the new display list with different object instances, i get only the context menu associated with the document class. i.e wherever i right click i get the context menu associated with the document class.
why is it that the context menus work as per the object properties on initialization and doesnt on rearranging the display list????
How Do I Add ContextMenu To Stage?
So in AS2 you could add a contextMenu for the whole movie like this:
Code:
var newMenu = new ContextMenu();
newMenu.hideBuiltInItems();
_root.menu = newMenu;
There is no _root in AS3. So in my Document class I tried this:
Code:
stage.contextMenu = new ContextMenu();
Which results in this error:
Error: Error #2071: The Stage class does not implement this property or method.
at Error$/throwError()
at flash.display::Stage/set contextMenu()
I have also tried just adding items to stage.contextMenu but that didn't work either.
I also added a custom context menu to my Document class but that doesn't work for the whole movie.
So does anyone know if there is something I can do to set the contextMenu for the whole movie?
Problems_cm = New ContextMenu();
I need to know how to make a sub-menu for a flash context menu. I have tried to create a menu item that is a menu in itself, but it wouldn't work. If anyone can help me with this, it would help.
ContextMenu Problems
I'm using the ContextMenu to handle some user interaction. Namely, when the user right-clicks, they have the option to add or remove items.
The problem I'm running into is this. When the event handler is called from one of my custom items being selected, I lose all reference to the local clip it's in. Tracing the _xmouse or _ymouse, this._x, etc. returns "undefined" for all. The only way I could reference anything was through _global or _root and working my way down.
The custom ContextMenu is created within a clip, and the handler that is catching the event is also within the same clip, which may be what is causing this...? Does it have to be created at the root or can I do it the way I'm doing it?
Has anyone ever ran into anything like this before?
Thanks much! Appreciate the help gang!
Costumize ContextMenu
I've created this sample code to explore the ContextMenu class, and I see no problem in this class. But now theirs the need to take it a bit further, and I got this ideia:
to costumize the ContextMenu i.e. change backgrounds colors, text color, etc.
Anyone with any relevant experience in this issue.
My current code:
ActionScript Code:
stop();
// cria um novo objecto contextmenu
root_cm = new ContextMenu();
// remove os items de origem
root_cm.hideBuiltInItems();
// cria um novo item e associa-o á função itemHandler
root_cm.customItems.push(new ContextMenuItem("Cuban Council", itemHandler));
// cria um novo item e associa-o á função itemHandler2
root_cm.customItems.push(new ContextMenuItem("K10K", itemHandler2));
// funçao itemHandler
function itemHandler(obj:Object, item:ContextMenuItem) {
getURL("http://www.cubancouncil.com","_blank");
}
// função intemHandler2
function itemHandler2(obj:Object, item:ContextMenuItem) {
getURL("http://www.k10k.net","_blank");
}
// cria o menu
_root.menu = root_cm;
The code creates 2 menu items linking to: k10k and cuban council (master of iconography and pixel)
Would like to chage ideias with people with relevant experience in this class and who extended it.
ContextMenu And The Clipboard
Does anyone know the code to get the htmlText from a text field to copy out to the clipboard?
I have the contextmenu item set up and a function ready, but I don't know how to reference the clipboard.
Thanks.
Right Clicking / ContextMenu
Ok, I know how to make a custom right-click menu.
When I test my flash offline, it works when right-clicking.
BUT...When I put it on my server, the right-click menu only works when right-clicking on a text field.
Here is the script I am using. Is there something I can add to make it work online?
Code:
function deadClick() {
}
var myMenu:ContextMenu = new ContextMenu();
myMenu.hideBuiltInItems();
var copyrightNotice:ContextMenuItem = new ContextMenuItem("© 2007 Element Student Ministries", deadClick);
myMenu.customItems.push(copyrightNotice);
menu = myMenu;
Help, How Can A Cancel A ContextMenu Call?
Hello, and thanks for your time.
I need to use the right click of the mouse without having to see the ContextMenu.
I know i can use onSelect to assign personal function to the right click before the ContextMenu pop-up, but isn't there any way to cancel the ContextMenu call after the use of "onSelect"?
[F8] Manual ContextMenu Invoke?
Hi all, quick question -
Is it possible to manually display a context menu at a certain point in time? I'm making an app and would like the user to be able to invoke the right-click context menu I've created when they click on a certain button on the stage. Any ideas? Thanks.
-T
Detecting ContextMenu Close?
I need to perform some operations when the user closes the ContextMenu. How can I trap this event?
I tried doing something like:
myMenu.addEventListener(MouseEvent.MOUSE_UP, MyFunction)
But that doesn't get called when the ContextMenu is closed.
Thanks much!!
Usefull Info About ContextMenu
I searched around the forum to find info about the ContextMenu Object. There is bunch of threads about this but I thought its good to post one more summarising the characteristics of the ContextMenu. If you have information about CM that isn't yet on this thread or something is inaccurate please post your info
My findings:
- The CM doesn't exsist for nested movieClips. Only for mc's that are on stage
- The CM can not (should not) be hidden without the usage of scripting languages like JavaScript
- The CM does not support images, font changes etc.
- some of the items can be hidden using hideBuiltInItems()
ContextMenu And Custom Cursor
HI everybody,
i got a big problem. I have tow mc on stage and defined three custom contextmenus, One for the stage (_root) and one for each mc.
I have a custom cursor, too. (_x,_y, enterFrameEvent)
The probem is that when i rightclick on a mc, it shows the _root contextmenu instead of the menu i assigned to the clip.
I think it's because the mc that is used for the custom cursor overlays all other elements and so i rightclick always on the curosr instance which has - of course- no custom menu?
Is there a way to get rid of this problem? I could do without the custom cursor but it would be great if somebody could help me with this issue.
ContextMenu Callbacks Not Firing
Hi All,
For some reason my context menus stopped working when Flash 8 came out. I finally got them to show up but the callbacks are not firing when clicked. Here is my code:
// **** functions called by external classes ****
public function rebuildMenu(txtT:String, txtB:String, txtR:String) {
this.itemMenu = new ContextMenu();
this.itemMenu.hideBuiltInItems();
this.itemMenu.customItems.push(new ContextMenuItem(txtT, moveToTop ));
this.itemMenu.customItems.push(new ContextMenuItem(txtB, moveToBottom));
this.itemMenu.customItems.push(new ContextMenuItem(txtR, removeLayer));
this.menu = itemMenu;
}
// **** functions called from the menu ****
public function removeLayer(obj) {
//first, find the item in the array that matches clicked item
var li = obj._parent;
var leg = li.legend;
var i:Number = leg.getIndex(li);
// remove the object, and the array entry
leg.legArr[i].removeMovieClip();
leg.legArr.splice(i,1);
//respace the layers
leg.spaceLayers();
leg.callRemove(i);
}
Any help would be appreciated.
Detecting When ContextMenu Opens
Is there any way to know when the Context Menu is opened? I can't find any events or properties to detect this.
In the browser, items underneath the Context Menu in a Data Grid are still being rolled over, and I need to stop it.
MyVideo.contextMenu = Menu;
ActionScript Code:
public class VideoTest extends Sprite
{
public function VideoTest()
{
...
var replay:ContextMenuItem = new ContextMenuItem("replay");
replay.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,replayHandler);
var fullscreen:ContextMenuItem = new ContextMenuItem("fullscreen");
fullscreen.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,fullscreenHandler);
var menu:ContextMenu = new ContextMenu();
menu.hideBuiltInItems();
menu.customItems.push(replay);
menu.customItems.push(fullscreen);
myVideo = new Video();
myVideo.attachNetStream(stream);
myVideo.addEventListener(MouseEvent.CLICK,clickHandler);
myVideo.contextMenu = menu;
addChild(myVideo);
}
}
Why is myVideo.contextMenu = menu; not working ? Meaning i do not see my menu options when i right click on the movie, only the default one's ?
ContextMenu To Open Using Jaws
Hi all,
I 'm having a bit of bother with Jaws not reading certain components in my application.
1. Menu bar - reads menu but won't read items
2. List box items
3. Opening a tree context menu - (num pad * in jaws)
Any ideas?
Cheers
ContextMenu Event Won't Fire
I'm using Flash CS3 and AS3 ......... I've created my contextMenu and it works fine.... BUT when I right click on top of my Video object none of the menuItem events will fire. They fire when I click anywhere else on the stage.
Can someone assist?
ContextMenu And Tree Component
Hey guys,
I've been searching on the web and through multiple forums, but this topic seems to get little or no responses. The desire for many is to be able to enable a context menu for individual nodes on the tree component.
Now I know it's possible because Drumbeat figured out how to do it, but it doesn't appear anyone else has. My best guess is using custom cell renderers, but all my tests so far have left me scratching my head. I'm very familar with using cell renderers. I can get my context menus to show up on regular objects, and also nested objects, just not the tree nodes.
I'm really stumped here and was hoping someone would open up to a possible solution. I know it would be well appreciated by myself, but also the Flash community in general. I'm publishing for player 8 and higher. Thanks for any help.
ContextMenu Callbacks Not Firing
Hi All,
For some reason my context menus stopped working when Flash 8 came out. I finally got them to show up but the callbacks are not firing when clicked. Here is my code:
Any help would be appreciated.
Attach Code
// **** functions called by external classes ****
public function rebuildMenu(txtT:String, txtB:String, txtR:String) {
this.itemMenu = new ContextMenu();
this.itemMenu.hideBuiltInItems();
this.itemMenu.customItems.push(new ContextMenuItem(txtT, moveToTop ));
this.itemMenu.customItems.push(new ContextMenuItem(txtB, moveToBottom));
this.itemMenu.customItems.push(new ContextMenuItem(txtR, removeLayer));
this.menu = itemMenu;
}
// **** functions called from the menu ****
public function removeLayer(obj) {
//first, find the item in the array that matches clicked item
var li = obj._parent;
var leg = li.legend;
var i:Number = leg.getIndex(li);
// remove the object, and the array entry
leg.legArr[i].removeMovieClip();
leg.legArr.splice(i,1);
//respace the layers
leg.spaceLayers();
leg.callRemove(i);
}
Scoping, MyClass, And ContextMenu
I have a class where I'm defining a context menu. The odd thing is, when I call the function, I can't call any variables from outside the function. The context menu calls the function correctly, but the scoping is all wonkey. Is there a way around this?
function checkIt() {
TEST = "test"
trace(TEST);
}
//////////// traces undefined
function checkIt() {
var TEST = "test"
trace(TEST);
}
//////////// traces "test"
I've tried referencing all readily available variables, but due to the way its formatted - will I be forced to use _root variables? Or is there a better way I'm not seeing?
ContextMenu In List Controls
I have a context menu defined as such:
_menu = new ContextMenu();
_menu.hideBuiltInItems();
this.menu = _menu;
placed in the init method of a cell renderer. However, the normal context menu appears when right clicking on an item.
I can place this same code on the main movie clip and it the updated context menu will display, but I only want it for the items in my list control.
Is there any way to get a specific context menu to work on a specific movie clip which is a cell renderer in a list control?[
Edited: 03/21/2008 at 02:00:45 PM by Ritteh
ContextMenu Visable=false?
hello .
i have a quick question .
i understand how to disable the built in context menu items ,
but i am having 1 problem ..
i cannot figure out how to disable "forward","back"?
i would like to have the ContextMenu just show "settings","about Macromedia Flash Player7"
any clues would be greatly appreciated..
cheers
ContextMenu Function Trigger
Is there possibility to run a function jus by right-click?
Hence, not to trigger function by ContextMenu option but just with right-click.
Thanx,
ContextMenu And Tree Component
hi
I want to be able to attach contextMenu items to nodes on a tree component, so that when the user right clicks on a node, a custom menu appears and clicking on a menu item returns the id of the selected node to an event handler attached to the menu item.
is this possible?
|