Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-14-2006, 03:03 PM   #1
silencer01
Registered User
 
Join Date: Sep 2003
Posts: 52
Default on 'right' click

Hi all,

I'm trying to capture a right click in flash. Please note that i'm not attempting to display a right click context menu. I simply want to call a function with a right click. Here is how i would do it with a left click:

PHP Code:
//This if for a normal left click (i require the save actions for a right click)
btn_test.onRelease = function(){
       
processBtn();
}

processBtn(){
       
trace("button clicked");

Thanks
silencer01 is offline   Reply With Quote
Old 03-14-2006, 03:11 PM   #2
jsebrech
Joeri Sebrechts
 
Join Date: Apr 2005
Location: Antwerp, Belgium
Posts: 1,465
Default

We'd all like to do that.

There are a few hacks floating around to get rid of the context-menu, but none of them seem to do the job adequately.
jsebrech is offline   Reply With Quote
Old 03-14-2006, 03:29 PM   #3
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

as long i know it violates MM lizense if you do so !

the only working solution i ever saw was overliing it whit an opacel Layer (in the HTML)

wich will prevent any clicks at all in the SWF wich woud need to by wraped back whit javascript !

wich is a nightmare
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 03-14-2006, 03:30 PM   #4
Unknowner
Member
 
Join Date: Jan 2006
Posts: 54
Default

its not fully possible in flash, but with a little bit help of javascript it's not too hard to get rid of the context menu.. or load ur own movieclip as a menu..

but then again, not all browsers supports the javascript function (in IE it does work but in mozilla it wont) and javascript can be closed in ur Browser Options..

you can find enough on google by searching for the terms "javascript flash context menu" or something like that..
Unknowner is offline   Reply With Quote
Old 03-14-2006, 03:38 PM   #5
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

i have try this javescript stoff a while ago and coudn't get it to work
in any browser !
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 03-15-2006, 06:51 AM   #6
jsebrech
Joeri Sebrechts
 
Join Date: Apr 2005
Location: Antwerp, Belgium
Posts: 1,465
Default

Frankly though, I approve of it not being possible to disable the context-menu. Flash movies shouldn't be able to disable access to the flash settings.
jsebrech is offline   Reply With Quote
Old 03-15-2006, 08:03 AM   #7
astgtciv
Resu Deretsiger
 
astgtciv's Avatar
 
Join Date: Jul 2005
Location: St-Petersburg, Russia
Posts: 2,329
Default

If you just want to capture the right click (the context menu will still be displayed), simply monitor Key.isDown(2) - it will return true when the right mouse button is pressed...
__________________
overstream.net: add subtitles to online videos (youtube, vimeo, blip.tv...).

Last edited by astgtciv; 03-15-2006 at 08:08 AM.
astgtciv is offline   Reply With Quote
Old 03-15-2006, 08:27 AM   #8
reyco1
To AS2.0 or not to AS2.0
 
Join Date: Mar 2005
Location: New York
Posts: 209
Send a message via AIM to reyco1 Send a message via MSN to reyco1 Send a message via Yahoo to reyco1
Default

I tried capturing right-clicks and I couldnt do it. I resulted to writing a peice of code that would capture double-clicks instead and used that
reyco1 is offline   Reply With Quote
Old 03-15-2006, 03:23 PM   #9
MichaelxxOA
Flash Sucks
 
MichaelxxOA's Avatar
 
Join Date: Mar 2005
Location: Victorville, Ca
Posts: 2,228
Send a message via AIM to MichaelxxOA Send a message via MSN to MichaelxxOA Send a message via Yahoo to MichaelxxOA Send a message via Skype™ to MichaelxxOA
Default

Why not just utilize the ContextMenu and ContextMenuItem classes that flash has to offer? I haven't found anything that necessitates me getting rid of the context menu, and Xeef is right it is against the MM license to do so.

About the solution in html, it's very involved, but you need to set the wmode of the swf to transparent ( I know it's odd ). You then need to create a div layer that sits over top of the SWF, this is where you are stealing the rightlcicks from the flash player, and you need to be sure to capture the right clicks with javascript and send them to the swf. This is possible, and it is compatible in both browsers. Good Luck .

_Michael
MichaelxxOA 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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
as2 and double click / drag detection huwn ActionScript 2.0 7 06-19-2007 04:36 PM
combine button double click with drag function ahungryghost ActionScript 2.0 2 01-27-2006 04:35 AM
Single click and double click with "s" key... moonwalker ActionScript 2.0 1 01-26-2006 10:44 PM
Help with my double click function s_purs ActionScript 2.0 2 09-19-2005 02:53 PM
count the number of btn have been click Jins ActionScript 1.0 (and below) 15 07-12-2004 10:03 AM


All times are GMT. The time now is 11:57 PM.

///
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.