在actionscript 3.0中,我正在使用Adobe Air创建一个iOS应用程序。对于主要玩家的动作,我正在使用按钮。每当我运行代码时,我都会收到错误。代码如下。
stop()
up_btn.addEventListener(MouseEvent.CLICK, fl_up);
function fl_up() {
player.x += 5;
}
如果有人能告诉我这段代码有什么问题,我们将不胜感激。
答案 0 :(得分:0)
当您发布有关您收到的错误的问题时,在分享错误代码/文字时最有帮助。打开调试,你就会明白为什么&代码破解的地方。也就是说,你忘了在你的事件监听器中持有一个论点;我怀疑那是罪魁祸首。
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;
}