问题
I am creating a Flash game. Unfortunately, when the Player presses "Enter," the game continuously cycles through its scenes. I tried the following (although I know it's a bit buckshee):
// The Enter Key was pressed
// If the Enter key is pressed, the keyboard input is "changed" to
// be '.'. This prevents a problem in which the Player would
// press 'Enter' and the game screen would continuously cycle
// through scenes
if (event.keyCode == Keyboard.ENTER) {
// The 'PERIOD' key does nothing
event.keyCode = Keyboard.PERIOD;
//spaceKeyPressed = true;
}
Is there a way to prevent 'Enter' from cycling through the scenes?
Thanks,
Christian
回答1:
While testing your game with Test Movie inside Flash Professional, select "Disable Keyboard Shortcuts" from the Control menu, Otherwise, as you can see in the Control menu, the first item is "Play" which has the Enter key as the keyboard shortcut.
Note that the items in the Control menu change depending on if you are currently testing a movie or not. You will only see the menu from the screenshot below while you are testing your game.
来源:https://stackoverflow.com/questions/9246556/flash-actionscript-3-0-enter-key-causes-scene-to-change