Flash Actionscript 3.0 “Enter” Key Causes scene to change

核能气质少年 提交于 2019-12-12 23:04:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!