本文介绍了如何检测,如果删除键是pssed在ActionScript 3的$ P $?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何确定是否删除键是使用ActionScript pressed?

 的addEventListener(KeyboardEvent.KEY_UP,的onkeyup);

...

功能的onkeyup(事件:KeyboardEvent的):无效
{
    跟踪(event.key code);
}
 

以上code产量没有价值的时候删除,退格,回车,和其它命令键是pressed。然而,方向键的执行的收益值。

解决方案

  this.stage.addEventListener(KeyboardEvent.KEY_DOWN,onKey pressed);
....

功能onKey pressed(事件:KeyboardEvent的):无效
{
   如果(event.key code == Keyboard.DELETE){
       .....
       }

}
 

它干活不错...但是,如果你从Flash测试影片,它不会工作,所以出口的SWF和测试......

How do I determine if the delete key was pressed using actionscript?

addEventListener(KeyboardEvent.KEY_UP, onKeyUp);

...

function onKeyUp(event:KeyboardEvent):void
{
    trace(event.keyCode);
}

The above code yields no value when delete, backspace, enter, and other command keys are pressed. However, arrow keys do yield values.

解决方案
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
....

function onKeyPressed(event:KeyboardEvent):void
{
   if (event.keyCode==Keyboard.DELETE) {
       .....
       }

}

it's workin nice...But if you test movie from Flash, it will not work, so export to swf and test....

这篇关于如何检测,如果删除键是pssed在ActionScript 3的$ P $?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 17:19