你能让键盘事件在不同页面上有所不同吗?
嘿,有没有一种方法可以让某些键在一个页面上做一件事,然后在另一个页面上做不同的事情,就像我使用的那样,
但是在下一帧上我不能再次使用空格键来执行另一项任务? 任何帮助将不胜感激
stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDownn);
function myKeyDownn(e:KeyboardEvent):void {
if (e.keyCode == Keyboard.SPACE){
gotoAndPlay("welcome");
}
}
Hey is there a way to have certain keys do one thing on one page and then different on another, as i use
But then on next frame i cant use space bar again to do another task?
Any help would be appreciated
stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDownn);
function myKeyDownn(e:KeyboardEvent):void {
if (e.keyCode == Keyboard.SPACE){
gotoAndPlay("welcome");
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需在离开框架之前删除侦听器即可。
在“welcome”框架中再次添加相同的代码,只需更改
gotoAndPlay()
部分。just remove the listener before you leave the frame.
in the frame "welcome" add the same code again and just change the
gotoAndPlay()
part.