如何将按钮作为键盘上的键 [英] how to make a button as a key in keyboard

查看:155
本文介绍了如何将按钮作为键盘上的键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个动作脚本代码来使舞台上的按钮作为键盘按键的键,以及如何在舞台上跟踪其内容.

i need an actionscript code to make button on my stage work as a key of the keyboard keys and how to to trace its content on stage

推荐答案

ur问题我不清楚.但是,如果您在舞台上有一个按钮,并且想为其分配快捷键,则只需为键盘创建一个监听器,然后为该按钮分配相同的方法,请单击

ur question is not clear to me. but if you have a button on stage and you would like to assign a keyboard key like a short cut to it, just create a listener for the keyboard and assign the same method of the button click

keyListener = new Object();
keyListener.onKeyDown = function() {
    x = Key.getAscii();
    trace("You hit: " + x);
};
Key.addListener(keyListener);


这篇关于如何将按钮作为键盘上的键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆