[英]Not getting key code for alt key flash AS3
I am having some trouble in getting key code for alt key. 我在获取alt键的键代码时遇到了一些麻烦。 Can Anyone help in it.
任何人都可以帮忙。 I am sharing for source code the way I am trying to do it.
我以尝试的方式共享源代码。
import flash.events.KeyboardEvent;
stage.addEventListener(KeyboardEvent.KEY_DOWN, function(e:KeyboardEvent){
trace("Key== "+e.keyCode);
txt.text=""+e.keyCode;
});
There is no key code for alt key. 没有alt键的键代码。 Instead, your should use KeyboardEvent#altKey getter, to check is alt key down or not.
相反,您应该使用KeyboardEvent#altKey getter来检查是否按下了alt键。
stage.addEventListener(KeyboardEvent.KEY_DOWN, function(e:KeyboardEvent){
if (e.altKey)
{
trace("Alt key is down");
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.