最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
as 3.0使用键盘代码
时间:2022-07-02 17:03:47 编辑:袖梨 来源:一聚教程网
as 3.0使用键盘代码
package cn.com.webstudio{
import flash.display.Sprite;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class KeyCodes extends Sprite {
private var box:Sprite;
public function KeyCodes() {
init();
}
private function init():void {
box=new Sprite();
addChild(box);
box.graphics.beginFill(0xff0000);
box.graphics.drawRect(0,0,40,40);
box.graphics.endFill();
box.x=stage.stageWidth / 2;
box.y=stage.stageHeight / 2;
stage.addEventListener(KeyboardEvent.KEY_DOWN,onKeyboardEvent);
}
public function onKeyboardEvent(event:KeyboardEvent):void {
switch (event.keyCode) {
case Keyboard.DELETE:
removeChild (box)
}
}
}
}
相关文章
- 美女请别影响我成仙珂儿好感怎么提升 闻人澜珂好感度提升方法 07-31
- 人渣SCUM倍镜怎么测距 倍镜测距方法介绍 07-31
- 明末渊虚之羽未・反击怎么获取 神之识获取路线攻略 07-31
- 美女请别影响我成仙潘素琴好感怎么升 潘素琴好感度提升教程 07-31
- 币安币逆转涨势,关键BNB价格水平需关注 07-31
- 美女请别影响我成仙白绾绾好感怎么升 白绾绾好感度提升攻略 07-31