阅读:1901次
评论:0条
更新时间:2011-05-26
在FirstWin.mxml中通过调用addKeyBoardListener方法可以设置键盘监听器,该方法在cn.smartinvoke.gui.SIApplication类中定义,方法说明如下:
public function addKeyBoardListener(listener:Function, target:Object, vk1:int = -1, vk2:int = -1, vk3:int = -1, characher:String = null):void
listener:Function 快捷键触发后的回调函数
target:Object 回调函数中this关键字所指代的对象
vk1:int (default = -1) 第一个虚拟键
vk2:int (default = -1) 第二个虚拟键
vk3:int (default = -1) 第三个虚拟键
characher:String (default = null) 字符键
如:在FirstWin.mxml中添加如下代码就可以实现键盘监听,
this. addKeyBoardListener(function():void{ Alert.show(“按下了ESC+E”);},this,VirtualKeys.VK_ESCAPE,-1,-1,"E"); this. addKeyBoardListener(function():void{ Alert.show(“按下了C”);},this,-1,-1,-1,"C"); this. addKeyBoardListener(function():void{ Alert.show(“按下了ESC+E”);},this,VirtualKeys.VK_ESCAPE,-1,-1,"E"); this.addKeyBoardListener(function ():void{ Alert.show("你按下了 control + shift +K"); },this,VirtualKeys.VK_CONTROL,VirtualKeys.VK_SHIFT,-1,"K");
评论 共 0 条 请登录后发表评论