View Full Version : [An Idea] Allow Right Clicks for Flash
MTsoul
April 12th, 2006, 05:02 PM
I was looking through my archives and I did a little CSS trick before to disable right clicks for Flash. It's basically putting a layer on top of the Flash so the Flash can't receive right clicks to make that menu.
But then I thought again, technically it would be possible to let Javascript handle right clicks and pass it onto Flash right? Then both left and right clicks become available for a flash movie. This would be especially useful for games involving the mouse.
JoshuaJonah
April 12th, 2006, 05:05 PM
you can disble the menu and then there is a keypress number that is undocumented in flash that == right-click, it's totally explained in 'Flash Hacks'. BTW theres also a keypress number for scrollup and scrolldown:)
hl
April 12th, 2006, 05:05 PM
Do you even need that extra layer on top of it? From my understanding, you can eliminate that menu in flash through actionscript. You may also put a right click menu.
I'm certain I've seen codes for both of the above while browsing through random actionscript tricks in the past.
TheCanadian
April 12th, 2006, 06:15 PM
You can't disable the right-click menu with AS but you can use the keyCode 2 along with the static Key.isDown method to detect when the right mouse button is down.
bombsledder
April 12th, 2006, 06:44 PM
are you sure about that canadian because i thought they got rid of that command :O
TheCanadian
April 12th, 2006, 06:50 PM
are you sure about that canadian because i thought they got rid of that command :O
I suppose you could try it and see:
onEnterFrame = function ():Void {
if (Key.isDown(2)) {
trace("right mouse button down");
}
};
:)
bombsledder
April 12th, 2006, 07:04 PM
ya i think they got rid of that command did you test it?
MTsoul
April 12th, 2006, 07:20 PM
It's not possible to get rid of the right click menu in a Flash Movie when it's played in a browser. It is possible to get rid of it when it is a standalone application.
So basically my idea is to use Javascript to catch all keyboard/mouse clicks and forward it to Flash.
codemonkeypete
April 12th, 2006, 07:57 PM
you cant totally get rid of the menu (embedded in html), but u can get close - custom menu code. make a new menu. u still get the settings/about menu items though :(
@bombsledder - ya i think they got rid of that code... mate, did "you" test it? .. works bloody nice here.
bombsledder
April 12th, 2006, 08:18 PM
ya just tested it, forgot where i read that they got rid of it, probably just some noob saying it, works perfect here maybe you could make a javascript class that will stop it would be nice
Jeff Wheeler
April 12th, 2006, 08:41 PM
Err… I'm not sure if you can track right clicks with JS… it'd be cool, though.
MTsoul
April 12th, 2006, 08:44 PM
It's basically this:
http://mtsix.com/wp-content/uploads/flash.html
See? No right click, because I've layered a DIV tag on top of the flash with CSS.
bombsledder
April 12th, 2006, 09:00 PM
all you had is <div id="flash"> or /we
MTsoul
April 12th, 2006, 09:06 PM
There are 2 divs, one containing the flash, and the other is given the properties 100% height and width, no background.
999
April 13th, 2006, 12:37 AM
See? No right click, because I've layered a DIV tag on top of the flash with CSS.
Doesnt seem to work in IE 7. I still get the menu.
http://s94688749.onlinehome.us/ie.jpg
MTsoul
April 13th, 2006, 01:10 AM
Ah blah. I'll check it out.
fluid_tw0
April 14th, 2006, 04:51 PM
right-click detection won't work in firefox 1.5.0.2
MTsoul
April 14th, 2006, 09:11 PM
Yeah Firefox doesn't detect it at all. If it did, there wouldn't be a need for a JS class to pass it onto Flash :P
Bash321
April 21st, 2006, 04:11 PM
and opera opens the same menu like pressong on a pages background, doesnt show the "you right clicked!" text
MTsoul
April 21st, 2006, 04:18 PM
and opera opens the same menu like pressong on a pages background, doesnt show the "you right clicked!" text
Yeah that means the CSS trick works with Opera, since it shows the page menu.
Bash321
April 21st, 2006, 04:20 PM
oh, i thougth it supposed to show nothing at all
MTsoul
April 21st, 2006, 05:15 PM
Well then that's just Javascript, nothing about Flash anymore.
vini
April 22nd, 2006, 08:08 PM
Huh..........................!!!
MTsoul
April 22nd, 2006, 08:43 PM
Huh?
vini
April 23rd, 2006, 11:50 PM
Yeah it dosent work on IE 7
pips
April 24th, 2006, 03:21 PM
I`m getting menu in IE 7 & Opera 9
crees
December 20th, 2006, 10:03 AM
It's basically this:
http://mtsix.com/wp-content/uploads/flash.html
See? No right click, because I've layered a DIV tag on top of the flash with CSS.
MTsoul, where are you passing the right-click event to Flash? I see you disabling right-clicking in JS but that's it. I'm trying to do just this and then the next step will be passing the mouse cordinates to Flash to bring up a menu where the mouse was clicked.
BTW, is it possible to allow the normal left-clicks to go through and only capture and process the right-clicks to send to Flash?
smartie.on.comp
December 25th, 2006, 03:20 PM
I know a way of doing and its simple by using a exe :D.
(1). Make a flash file that contains the on if(Key.isDown(2)){ event.
(2). publish the swf to an exe file.
(3). download resource hacker from http://www.angusj.com/resourcehacker/
(4). open resource hacker then click file -> open -> YourFlashExeFile.exe
(5). on the left hand side open menu -> 604 -> 1033 (in my case because its english)
(6). remove
POPUP "x"
{
MENUITEM "Zoom &In", 20042
MENUITEM "Zoom &Out", 20030
MENUITEM "&100%", 20046
MENUITEM "Sho&w All", 20034
MENUITEM SEPARATOR
POPUP "&Quality"
{
MENUITEM "&Low", 20035
MENUITEM "&Medium", 20036
MENUITEM "&High", 20037
}
MENUITEM SEPARATOR
MENUITEM "&Play", 20039
MENUITEM "&Loop", 20043
MENUITEM SEPARATOR
MENUITEM "&Rewind", 20025
MENUITEM "&Forward", 20040
MENUITEM "&Back", 20041
MENUITEM "Movie not loaded...", 20045
MENUITEM SEPARATOR
MENUITEM "&Settings...", 20058
MENUITEM SEPARATOR
MENUITEM "Pr&int...", 20054
MENUITEM SEPARATOR
MENUITEM "&About Macromedia Flash Player 8...", 20044
}
(7). click 'compile script'
(8). click save
Enjoy!
evildrummer
December 25th, 2006, 04:43 PM
is that the byte code because theres another program which allows you to edit .swf byte code
Jimp
December 25th, 2006, 04:57 PM
Well you can definatly change the menu options in flash, but I dont know about totally disabling it...
function menuChoiceOne()
{
getURL("http://www.kirupa.com","blank");
}
NewMenu = new ContextMenu();
NewMenu.hideBuiltInItems();
NewMenu.customItems.push(new ContextMenuItem("Visit Kirupa.com!", menuChoiceOne));
this.menu = NewMenu;
This is used well on www.wallop.com if youd like an example.
smartie.on.comp
December 25th, 2006, 05:12 PM
for those who want an example, download ithere (http://mbcity.hopto.org/flash.rar)
MTsoul
December 25th, 2006, 06:45 PM
Yes the goal is to disable it for good.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.