PDA

View Full Version : Disabling Keyboard Shortcuts by Script


CliveCarrington
10-20-2008, 06:28 PM
I have looked for this all over the internet but never found what I was looking for. It seems like no one has encountered this problem, so I assume it's a very simple one and I just missed something.

The problem is, when I run the SWF, even outside Flash, I can still use shortcuts. For example, [Ctrl + Right Arrow] to go to the next frame or [Ctrl + Enter] to play.
I didn't find a way to disable this, not script-wise, not through the Publish Settings menu and not by exporting the movie properly (through the menus).

This is a serious problem for me, since I'm making a game, and I can't possibly afford that players will be able to go through the frames as they like, because it makes a big mess in the script.
If there is no way to disable the keyboard shortcuts, the only way to prevent players from messing up the game is to change the structure of the timeline, and completely re-write almost all of the code.

I must also add:
I know that when you run the SWF in the internet browser the shortcuts I'm talking about are disabled, but that's not a solution. I want the game to be also played offline, on the local machine.
I thought that by disabling the contextMenu default items it might also disable the shortcuts to the actions that these items execute, but I was proved false.

What did I miss?

Thanks very much to anyone who helps!

EDIT: The version of Flash that I am using is CS3, but the version of ActionScript I work with is 2.0.

vinayak.kadam
10-21-2008, 12:50 PM
Can you please let us know which version of flash you are using.

As ever,
Vinayak Kadam

vinayak.kadam
10-23-2008, 12:22 PM
Can any of teh moderators please answer this. I think this really shud be very important question to be answered. even I searched on google and had no links to any such issue.

As ever,
Vinayak Kadam

CyanBlue
10-23-2008, 03:06 PM
Howdy and Welcome... :)

FYI, a moderator moderates the forum... Don't get confused with that... ;)

As far as I am aware, that's Flash Player specific keyboard shortcuts that cannot be disabled... I'd love to be proven wrong though...

CliveCarrington
10-23-2008, 10:20 PM
It's inconceivable that we can't disable that. It completely changes the way we must work with Flash. There simply has to be a way. Really.

vinayak.kadam
10-24-2008, 06:57 AM
It's inconceivable that we can't disable that. It completely changes the way we must work with Flash. There simply has to be a way. Really.

Absolutely agreed that there has to be a way. Even I am surprised at this. In between the workaround for this is to put gotoAndStop(prevframe()) after the frame where u have stopped the user for some action.

Souzou
08-21-2009, 04:04 PM
fscommand("trapallkeys", "true") seems to work for this. It prevents the Flash player from looking at any of the keyboard input (and re-directs it to your own key event handlers), so ALL keyboard shortcuts for Flash should be disabled.

A little late, but hopefully this will help others out there searching.