AS3检测按键
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AS3检测按键相关的知识,希望对你有一定的参考价值。
Use this to detect key presses and respond to them.
import flash.ui.Keyboard; import flash.events.KeyboardEvent; stage.addEventListener(KeyboardEvent.KEY_DOWN, onStage_KEY_DOWN); stage.addEventListener(KeyboardEvent.KEY_UP, onStage_KEY_UP); function onStage_KEY_DOWN(event:KeyboardEvent):void { trace("onStage_KEY_DOWN"); if (event.keyCode == Keyboard.SPACE) { trace("Keyboard.SPACE"); } } function onStage_KEY_UP(event:KeyboardEvent):void { trace("onStage_KEY_UP"); if (event.keyCode == Keyboard.SPACE) { trace("Keyboard.SPACE"); } }
以上是关于AS3检测按键的主要内容,如果未能解决你的问题,请参考以下文章