【问题标题】:Button Movement Control in AS3 ErrorAS3 错误中的按钮移动控制
【发布时间】:2014-02-09 02:06:44
【问题描述】:
在 actionscript 3.0 中,我正在使用 Adobe Air 创建一个 iOS 应用程序。对于主要玩家的移动,我使用的是按钮。每当我运行代码时,都会出现错误。代码如下。
stop()
up_btn.addEventListener(MouseEvent.CLICK, fl_up);
function fl_up() {
player.x += 5;
}
如果有人能告诉我这段代码有什么问题,我们将不胜感激。
【问题讨论】:
标签:
ios
actionscript-3
air
adobe
【解决方案1】:
当您发布有关您收到的错误的问题时,分享错误代码/文本最有帮助。打开调试,您将确切地知道代码中断的原因和位置。也就是说,您忘记在事件侦听器中保留参数;我怀疑这是罪魁祸首。
stop() // <- If this is the only frame on your document, you really don't need this.
up_btn.addEventListener(MouseEvent.CLICK, fl_up);
function fl_up(e:MouseEvent):void {
player.x += 5;
}