Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-01-2008, 12:09 PM   #1
nbyte
Registered User
 
Join Date: Jul 2008
Posts: 25
Default How to disable right click menu

Hi.
I want to write flash project using ActionScript 3 which will be running under web browsers.
And I'd like to disable default right click menu and handle right mouse button for my other events.
I tried to do
HTML Code:
<param name="menu" value="false"/>
but it only removes zoom buttons.
So I'd like to know, It's possible to remove all menu?
nbyte is offline   Reply With Quote
Old 07-01-2008, 12:53 PM   #2
panel
AS3
 
panel's Avatar
 
Join Date: Mar 2007
Location: Warsaw
Posts: 1,991
Send a message via Skype™ to panel
Default

Officially it's not supported by FlashPlayer, but there is trick involving javascript (As I recall it won't work on Opera)
http://www.uza.lt/blog/2007/08/solve...-click-in-as3/
panel is offline   Reply With Quote
Old 07-01-2008, 03:37 PM   #3
nbyte
Registered User
 
Join Date: Jul 2008
Posts: 25
Default

I tried. But I think this is unreliable. Because for exampe on my browser FF 2.0.0.14 this flash http://polygeek.com/377_adobeflash/a...click-in-flash doesn't work (right click).
nbyte is offline   Reply With Quote
Old 07-01-2008, 08:14 PM   #4
arpace
I must have ADHD
 
Join Date: Oct 2004
Location: Toronto
Posts: 130
Default

I have used the UZA's script and modified to to make it easier to use with multiple flash objects in the window; yet, it only works well in Windows with IE and gecko based browsers; as well, I haven't had very positive results under Linux.

I have tried to get it to work in opera, and I can get it to recognize that it has been pushed; yet, I can't get rid of the default event, cause stopping propagation seems not to work.

I have also tried using the fact that it recognizes the right click to call a function that injects javascript to put a layer on top of the default flash context menu; it works, yet you still see the menu for a second.

Last edited by arpace; 07-01-2008 at 08:25 PM.
arpace is offline   Reply With Quote
Old 07-02-2008, 10:16 AM   #5
panel
AS3
 
panel's Avatar
 
Join Date: Mar 2007
Location: Warsaw
Posts: 1,991
Send a message via Skype™ to panel
Default

Quote:
Originally Posted by nbyte View Post
I tried. But I think this is unreliable. Because for exampe on my browser FF 2.0.0.14 this flash doesn't work (right click).
Works for me in FireFox 2.0.0.14

Quote:
Originally Posted by arpace View Post
I have tried to get it to work in opera, and I can get it to recognize that it has been pushed; yet, I can't get rid of the default event, cause stopping propagation seems not to work.
Opera has native menu when using right click - I believe that is reason for RMB not working
panel is offline   Reply With Quote
Old 07-02-2008, 11:33 AM   #6
nbyte
Registered User
 
Join Date: Jul 2008
Posts: 25
Default

Sorry All. It's working now on FF. I tried on wrong demo.
Thank you so much for help.
nbyte is offline   Reply With Quote
Old 07-03-2008, 12:16 PM   #7
nbyte
Registered User
 
Join Date: Jul 2008
Posts: 25
Default

I would like to ask one more question about right click demo.
I see on http://www.uza.lt/blog/2007/08/solve...-click-in-as3/ page two source codes. But when I tried to use this I downloaded demo source code from http://code.google.com/p/custom-cont...downloads/list. And I see that in html page there flashobject is declarated with these not standard code lines
Quote:
<script type="text/javascript">
var so = new SWFObject("RightClick.swf", "customRightClick", "560", "420", "9", "#CCCCCC");
so.addParam("quality", "high");
so.addParam("name", "customRightClick");
so.addParam("id", "customRightClick");
so.addParam("AllowScriptAccess", "always");
so.addParam("wmode", "opaque");
so.addParam("menu", "false");
so.addVariable("variable1", "value1");
so.write("flashcontent");
</script>
As I understood it's using SWFObject object from swfobject.js javascript file. Now I'm trying to understand what this file actually do. I decompressed this file, but I still can't understand it.
It's possible to declare flashobject with standard method, but with the same functionality?
nbyte is offline   Reply With Quote
Old 07-03-2008, 01:24 PM   #8
jkennedy3421
Registered User
 
Join Date: Jun 2008
Posts: 5
Default Disable Right click

Quote:
Originally Posted by nbyte View Post
Hi.
I want to write flash project using ActionScript 3 which will be running under web browsers.
And I'd like to disable default right click menu and handle right mouse button for my other events.
I tried to do
HTML Code:
<param name="menu" value="false"/>
but it only removes zoom buttons.
So I'd like to know, It's possible to remove all menu?
---------------
I know this one works....I think its from dynamic drive so I just put that in there. I think it works in everything but opera. Hope this helps.

<script language=JavaScript>
<!--

//Disable right mouse click Script
//By Dynamic Drive

var message=" Your message here";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!docume nt.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// -->
</script>
jkennedy3421 is offline   Reply With Quote
Old 09-22-2008, 08:53 AM   #9
aestheticsData
Registered User
 
Join Date: Sep 2008
Posts: 1
Default disable context menu

stage.showDefaultContextMenu = false;
aestheticsData is offline   Reply With Quote
Old 09-22-2008, 12:45 PM   #10
Clox
Flexer 'n Flasher
 
Clox's Avatar
 
Join Date: Nov 2004
Location: Sweden
Posts: 496
Send a message via MSN to Clox Send a message via Skype™ to Clox
Default

Quote:
Originally Posted by aestheticsData View Post
stage.showDefaultContextMenu = false;
That doesn't disable it.
It just removes some of its content.
__________________
You don't need a reason to help people. - Zidane/FF9
I wish there were more flashing girls. - ( |_ [] }{
Clox is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable right click menu.. SBHawk ActionScript 2.0 13 04-17-2007 02:06 PM
disable right click dechef ActionScript 2.0 8 07-05-2006 07:24 AM
Right click menu and custom cursor Croft Storm ActionScript 2.0 2 06-24-2006 03:11 PM
prevent radio button / checkbox or drop down menu clicked after click submit button hoayfern ActionScript 1.0 (and below) 1 10-07-2002 02:36 PM
How can i disable right click? leegallen Other Flash General Questions 7 08-29-2002 09:12 PM


All times are GMT. The time now is 04:34 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.