remove the right click menu in flash 9
Asked Answered
S

8

8

Is it possible, using actionscript 3 to disable the right click menu?

Any help greatly appreciated!

Suspensor answered 18/12, 2008 at 6:8 Comment(1)
An API has been added for this in Flash Player 11.2, see https://mcmap.net/q/1237500/-remove-the-right-click-menu-in-flash-9Nympholepsy
S
4

I don't think you can do this in AS3 (Adobe probably never put support in there because it would prevent the user from accessing the security settings).

There are ways to do it through HTML, etc.

Check out http://www.actionscript.org/forums/showthread.php3?t=175669

Superannuation answered 18/12, 2008 at 6:21 Comment(0)
R
24

You can use:

stage.showDefaultContextMenu = false;

to hide everything but the settings option.

Rakehell answered 18/12, 2008 at 11:31 Comment(1)
@brenjt No, this hides also the Flash Player Menu. I like the myContextMenu.hideBuiltInItems(); better.Estellaestelle
A
19

Starting with Flash Player 11.2, it's possible now to override the behavior for the right button click on the mouse, e.g.

stage.addEventListener(MouseEvent.RIGHT_CLICK, function(e:Event){});

Here is the corresponding entry in the ActionScript 3 reference.

Axseed answered 20/9, 2012 at 19:22 Comment(2)
Now THIS is the best news!Estellaestelle
This crashes Flash Player for me. Not even a runtime error that I can catch. It just breaks. I'm targeting Flash Player 21.Ambitendency
S
4

I don't think you can do this in AS3 (Adobe probably never put support in there because it would prevent the user from accessing the security settings).

There are ways to do it through HTML, etc.

Check out http://www.actionscript.org/forums/showthread.php3?t=175669

Superannuation answered 18/12, 2008 at 6:21 Comment(0)
G
3

You can hide everything except for the Settings item, as said by Lain.

By the way: If you need to customize it you can use the ContextMenu class from the flash.ui package. Call hideBuiltInItems on it first to hide everything except for the Settings and then assign it to the menu property of the object you want to use the menu for (or root for the entire applet).

FYI, there is a nice tutorial about it that you can find here

Gemstone answered 30/12, 2008 at 13:41 Comment(0)
H
2

this code would also work

var newMenu=new ContextMenu();
newMenu.hideBuiltInItems();
this.menu = newMenu;
Huntlee answered 16/11, 2009 at 13:17 Comment(0)
F
1

Hello a couple of years later. I had the same problem but while using a touch-screen. If you keep the pointing device (my finger) touching the screen for more than a second the "right-click menu" will show up. I soved it going to the control panel under Windows7, "Pencil and input devices", Touch Tab, Actions, Turn off actions for "Keep pressed".

My windows is in spanish and the names are problably a bit different but I'm sure you'll know which button is which.

Fabiolafabiolas answered 13/10, 2015 at 11:59 Comment(0)
A
0

This is a better option

_level1._y = 195;
var myMenu:ContextMenu = new ContextMenu();
myMenu.hideBuiltInItems();
_root.menu = myMenu;
Adel answered 23/12, 2009 at 10:27 Comment(0)
A
0

If you can live with wmode opaque then you can intercept the right click at browser level as done here:

http://www.uza.lt/rightclick/

Amrita answered 12/6, 2015 at 14:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.