Newest Articles

MegaCombs
Flash Media Player
XML Driven Pie Chart
Base Defender
Hangman Game
8 Ball Pool


Popular Articles

True Fullscreen Flash Mode
Mp3 Player with XML Playlist
Image Slider
Flash Media Player
3d Rotating Image Cube
FLV Player


Random Articles

Motion along a Path
Custom Right Click Menu
Combs
Hangman Game
XHTML Image Mapper
Base Defender


Links

Foundation-Flash
MickM
TutorialQuest
Tutorialsphere.com - Free Online Tutorials
Newgrounds
TWiT
Link to SwfSpot
Swf Spot



rss feed

Custom Right Click Menu

Custom Right Click Menu
AddThis Social Bookmark Button
Description: Change flash's default right-click menu using actionscript.
Author: John Bezanis
Added: January 21st 2007
Version: Flash 8


Changing the right click menu is simple and takes only a few lines of code.
actionsframe
Place the following code in the Actions tab on the main stage:
  1. var linkURL="http://www.bezzmedia.com";
  2. var linkText="Link Text";
  3. //Defines a new right-click menu
  4. var myMenu = new ContextMenu();
  5. //goToThisURL is a function that gets run whenever the link is clicked
  6. function goToThisURL(){
  7.   //_blank opens the link in a new window
  8.   getURL(linkURL, "_blank");
  9. }
  10. //Create a new item for the new menu.
  11. var copyright = new ContextMenuItem(linkText, goToThisURL);
  12. //Add the item to the new menu
  13. myMenu.customItems.push(copyright);
  14. //Hide flash's built in items (zoom in, zoom out, etc)
  15. myMenu.hideBuiltInItems();
  16. //Apply the new menu
  17. _root.menu = myMenu;
Additional items can be added to menu by adding in a few lines just before the last line.
  1. function someFunctionName(){
  2.   //_self opens the link in the same window
  3.   getURL(linkURL, "_self");
  4. }
  5. var menuItem = new ContextMenuItem("Some More Link Text", someFunctionName);
  6. //Add the item to the menu
  7. myMenu.customItems.push(menuItem);
Menu items can perform tasks other than redirecting the browser. Simply place the actionscript you'd like to run inside of the function and the code will execute when the menu item is clicked. The provided example has a function which draws a line at a random location.

Download Source File
Comments
I wants add Change size option in Right click menu of Flv Player. And in this option i wants add 680x540, 480x360, 320x240 options. How can i do this.
December 12th 2007 01:12AM   -   James
I'm no pro but i believe _global would hold the document's dimmentions. If you want to change the size of the player that is playing the video, that would be javascript DOM
March 22nd 2008 10:03PM   -   guy
yep, to change the size of your flash you need to create a javascript function that resizes your flash movie, and call that function inside the flash movie.
google it, you'll might find something related
April 10th 2008 12:04PM   -   JJ
Could you not just create 3 webpages with different sized movies and open them up via the right click menu?
April 24th 2008 07:04AM   -   mark
Worked For Me ..Thanks!!
April 3rd 2009 07:04AM   -   Vinay
Thank U!!!
Thank U!!!
Thank U!!!
Thank U!!!
Thank U!!!

& AGAIN

Thank U!!!
April 16th 2009 02:04PM   -   Umarfaruk M
I want to use the XSPF Web Music Player from Fabricio Zuardi
(http://musicplayer.sourceforge.net/) and I try to change the click with the right mouse button because I want remove the download option.

I don't get it out, can you please help me to get a default right mouse button like in a standard swf file.

I plashed the player on this site
http://www.deweblog.nl/PLAYER/muziekplayer.html and I removed out of the xspf_player.as the "customized menu" but I can still download the music. I still get the menu that I don't wanna have.

I hope that someone will help my with this. Thank you very much.

Here is the .as file: http://www.deweblog.nl/PLAYER/xspf_player.txt

PLEASE PLEASE help my !!!


April 18th 2009 09:04AM   -   Sol
I want to have goto next frame on right mouse click.

Any Body have an idea ?
May 22nd 2009 09:05AM   -   Uzair
Great, this one worked for me too! Finally !!
May 25th 2009 04:05AM   -   kopirovanie v pezinku
looks easy!
June 1st 2009 08:06AM   -   <a href="http://w
How is it possible to make a new item, with no link but only text?
I'm happy if anybody helps me.
November 6th 2009 09:11AM   -   ytrr
How is it possible to make a new item, with no link but only text?
I'm happy if anybody helps me.
November 14th 2009 03:11AM   -   Hermes Handbags
That is an awesome cube, thanks for sharing.
December 13th 2009 07:12AM   -   dental
we can only take advantage of this trick in our own flash file, i wonder if we could do some tricks to other flash files on the run time
December 16th 2009 08:12PM   -   folders printing
yes, you are right, i wonder that would be amazing technique, we can hope for the next post with this solution buddy.
December 23rd 2009 11:12PM   -   cheap cricket phones
How is it possible to make a new item, with no link but only text?
I'm happy if anybody helps me.
January 1st 2010 09:01PM   -   Cialis
i like
January 4th 2010 02:01AM   -   Designer Wedding Dresses
Thank you so much.........
January 4th 2010 05:01AM   -   Ashok Rathod
The blog is really informative and i like to share it with my friends we can easily learn more about web designing through this post thanks for post
January 15th 2010 08:01PM   -   evening dresses
The custom right click menu was setup pretty nicely. I'm looking for a CSS solution.
January 20th 2010 09:01PM   -   McFarlane Sports Picks
It's nice tutorial
January 24th 2010 07:01AM   -   evening dresses
great to share some knowledge
January 24th 2010 09:01AM   -   Acai Berry 2
Custom Right Click Menu is great.
January 26th 2010 03:01AM   -   book
This is the informative article.
January 26th 2010 03:01AM   -   film
Special thank for good post.
February 5th 2010 09:02PM   -   à¹‚หลดเพลงà
Thank for the information
February 6th 2010 07:02AM   -   à¹‚หลดเพลงm
Special thank for good post.
February 10th 2010 03:02AM   -   à¹‚หลดเพลงà
Special thank for good post.
February 10th 2010 08:02AM   -   à¹‚หลดเพลงà
Add a Comment
name:
website (optional):
captcha type the characters into the box
message (5000 characters or less):