Monday, August 27th, 2007

Right Click and Flash

Category: Flash, JavaScript, Library

<p>Zoom In? Really? How often do you ever want to zoom in on an app? But we have all seen that when we right click on a Flash file.

Paulius Uza has a solution for the right click context menu and has posted the code on a Google Code project.

Why would anyone want to do this? Well, there are several very important reasons:

1) Games – the power of AS3 has brought Flash to the world of digital entertainment. At last it is possible to focus on the idea of your game rather than on how to improve the laggy experience. One thing that is still missing – right click functionality. We had this forever in desktop games, now it is time to let your casual RTS, RPG and FPS creations conquer the web.

2) User Experience – 2 buttons are better than 1. Every experimentalist’s dream is to be able to have more input options, not just one button. I can bet someone would soon create a stunning interface using this new functionality and we would see that on no less than FWA.

3) RIA – Rich Internet Applications. My clients are often asking if it is possible to remove embeded Flash Player menus from their applications and replace them with their company’s branding stuff.

Right Click

Related Content:

  • Grand master, no Flash
    E-visionaries: Jakob Nielsen is a world authority on Web usability and the scourge of corporate "bloat" in site design. As...
  • Create a bootable USB flash drive -- in a flash!
    Making a USB flash drive into a bootable USB device requires some fancy...
  • Right-sizing services
    Early proponents of SOA realize they must size their services just so and tackle aspects of architectural best practices. This tip discusses how SOA...
  • How to stop malware in a 'Flash'
    Always innovating, attackers have found ways to mask their malware by placing the code into PDFs and Flash files. The malware often appears to be...
  • How to stop malware in a 'Flash'
    Always innovating, attackers have found ways to mask their malware by placing the code into PDFs and Flash files. The malware often appears to be...

Posted by Dion Almaer at 5:29 am
16 Comments

+++--
3.7 rating from 42 votes

16 Comments »

Comments feed TrackBack URI

doesn’t work in safari 3 on mac

Comment by Gudbergur — August 27, 2007

document.oncontextmenu not good enough? Why is this of any use?

Comment by domce — August 27, 2007

Ups, you said flash. My bad!

Comment by domce — August 27, 2007

I’ve tried to make my kids games in flash, and when they were 2 to 4 years old it was simply impossible because they could not avoid the right click. Every 2 minutes it was “Daddy!?” and there is the damn flash right click menu. Given all the kids games out there in flash, this hack could be very useful. Or maybe its just my kids…

Comment by Joe Larson — August 27, 2007

Doesn’t work for me too.

Comment by Stephan Michels — August 27, 2007

Doesn’t work here…

Comment by Fabio Zendhi Nagao — August 27, 2007

I frequently use “Zoom In” on annoying Flash ads with animations. They don’t stop when you hit escape and the context menu items that are supposed to work (“Play” and “Loop” IIRC) are a disaster, possibly purposefully so. This custom context menu stuff will make it even easier for corporate shitheads to annoy visitors. I’d much rather see new ways for end users to control Flash Player.

Comment by Tim Cooijmans — August 27, 2007

“My clients are often asking if it is possible to remove embeded Flash Player menus from their applications and replace them with their company’s branding stuff.”

You can customize the flash context menu as much as you want, as long as you don’t remove adobe’s branding and options. So, unless your clients want you to replace adobe’s branding, I’m not quite sure what is meant here.

Comment by Joeri — August 27, 2007

I read that last week, as well as a link or two to it, but wasn’t sure what the “this” in “Why would anyone want to do this?” was.

I don’t think it’s “How can I customize the context menu?”, because search term “flash player context menu” shows that this goal has been practical for quite a few years.

At first I tested the illustration of “this” on Safari/Mac, then tried again in Firefox/Mac and saw that it could superimpose the browser’s context-click while also intercepting the event for a drawing action.

What do you understand that this project enables…?

(Like Tim, I get annoyed with ads which use embedded clips or menu adjustments to remove the “Pause” options. As Joeri notes, the Player’s context menu will always the engine as Adobe Flash Player.)

jd/adobe

Comment by John Dowdell — August 27, 2007

Dion,

The Flash Player context menu has been customizable for years, and many people use this already (but not enough). You can turn off the “zoom” options and all the other defaults except the “About Flash Player” default. This one is mandatory because it is how the end user can reach their privacy settings. You can also create any new contextual menus that you like. This is well documented here: http://livedocs.adobe.com/flex/2/langref/flash/ui/ContextMenu.html

Kevin’s post here can give you a lot more background and an example: http://blog.kevinhoyt.org/2007/01/11/flex-2-context-menus/

HTH,
David
Adobe

Comment by David — August 27, 2007

Hey everyone,

Thank you for your feedback (over 1000 emails!) and the interesting discussion.

To answer JD’s question, by “this” I did not mean “Customizing flash menu” like some of the people here think, but instead to use the right-click event in action script for other uses (for ex. RTS games where left-click selects units and right-click dispatches orders).

The real question however is if the possibility of having a useful second mouse event in flash player instead of a mostly useless default menu would hurt anyone? Will it enable any kind of scam / will it be abused?

I think no. I think it will enable developers to deliver new generation of user interfaces and new ways to interact with content. In the world of multitouch interfaces we are still tied to a single click in Flash and I would like to be able to change that.

However during the initial testing on all available platforms we are stuck with Opera (which abuses JS standard by kidnapping mouse events), linux (due to X11) and several older browsers and mouse gesture plugins.

In short – JS hack will never be a perfect solution, although it works on 86% of tested cases. If a real right-click in Flash is to happen anytime soon – it has to come from within Adobe.

Comment by Paulius Uza — August 27, 2007

Good post

Comment by VeroMaxx — January 21, 2008

Unless you are targeting a specific browser, this is not a good solution.
It does not work in Firefox with contextmenu trapping turned off and does not work in Opera among others. Even worse in these two cases the brower menu comes up. This can be corrected by setting the window mode to “window” instead of “opaque” and at least you will get a consistent flash context menu across browsers.

The Abobe people who have responded think that their context menu handling is acceptable. IT IS NOT ! WE NEED CONTROL OVER RIGHT CLICK !

Problems with Flash context menu:

1) With the Adobe context menu you can not use graphics or colors or perhaps match the color scheme of the webpage.

2) You cannot spawn a context menu programmatically. What if you want to display a context menu on any click of the mouse or perform some other function on right click ?

3) While there is an event prior to the context menu being displayed, there is no event when the context menu is dismissed say by the ‘escape’ key. What if your app needs to know this Abobe ?

4) There are many times when you want to display a menu on left click. This is the normal way. Well in flash chances are your custom menu will not match the Flash context menu which is unacceptable. If you could trap right click you are free to design your own menus and get the look and feel you need.

Adobe, stop thinking you know what people need, listen and use some imagination for pete’s sake.

Comment by DonMoir — February 9, 2008

Signing petition for true right click event handling! Please Adobe!

Comment by bgolson — June 3, 2008

senks http://cpmusicpub.com

Comment by bashkov — July 19, 2008

I found a way to remove it and that’s work on all browser but we need to hack a file. If somebody has more skill to make a plugin with this it would be really nice. Take care because this will remove the right click on all flash movie on Web. For a local game this is perfect.

http://membres.lycos.fr/micban/

Comment by Maeiky — December 18, 2008

Leave a comment

You must be logged in to post a comment.