Daniel
Daniel

Reputation: 35684

disabling context menu and mouse in Flash

This should be pretty straight forward.

this should do the trick

stage.removeEventListener(MouseEvent.RIGHT_CLICK, function(e:MouseEvent):void{});
Mouse.hide();

and when I run it in the standalone player it works.

However when I run it in a browser, the right-click menu shows up again. I've tried setting the param wmode="opaque", which removes context menu (independent of the code), but shows the mouse despite the css setting: cursor: none;

is there a another listener that calls the context menu that can be disabled?

Upvotes: 0

Views: 1973

Answers (1)

akmozo
akmozo

Reputation: 9839

To disable the context menu ( and the right click ), you can use MouseEvent.RIGHT_CLICK and / or MouseEvent.CONTEXT_MENU ( available from Flash Player 11.2 and up ) :

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

Mouse.hide();

Hope that can help.

Upvotes: 1

Related Questions