Actionscript 3.0:键盘事件和远程演示者
我有一个简单的 Flash 影片,代码如下。这个想法是使用键盘上的箭头键从一帧移动到下一帧或返回:
stop();
//listen for key press
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
//if left or right arrow, go to previous or next frame
function myKeyDown(e:KeyboardEvent):void {
switch (e.keyCode) {
case Keyboard.LEFT :
prevFrame();
break;
case Keyboard.RIGHT :
nextFrame();
break;
}
}
因此,这工作正常,只是我需要使用 Kensington Presenter 远程控制键盘。它应该向计算机发送向右或向左箭头键的 keydown 命令,但它不起作用。
它确实适用于我拥有的旧版 Director 项目,使用类似的语法。也适用于 PowerPoint。
任何想法将不胜感激。我正在 Mac 上工作,但电影将作为编译的应用程序在 Windows 和 Mac 平台上运行。
I have a simple Flash movie with the following code. The idea is to move from one frame to the next or back using the arrow keys on the keyboard:
stop();
//listen for key press
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
//if left or right arrow, go to previous or next frame
function myKeyDown(e:KeyboardEvent):void {
switch (e.keyCode) {
case Keyboard.LEFT :
prevFrame();
break;
case Keyboard.RIGHT :
nextFrame();
break;
}
}
So, this works fine, except that I need to use a Kensington Presenter to control the keyboard remotely. It should be sending a keydown command to the computer for either the right or left arrow keys, but it does not work.
It does work on a legacy Director project I have, using a similar syntax. Also works in PowerPoint.
Any thoughts would be appreciated. I'm working on a Mac, but the movie will run on Windows and Mac platforms as a compiled application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果它没有抛出错误,您必须聚焦阶段并在事件监听器下面编写
If it doesn't throw an error, you must focus stage and write below event listener