2014-02-09 29 views
0

在actionscript 3.0中,我使用Adobe Air創建了一個iOS應用程序。對於主要玩家的移動,我正在使用按鈕。每當我運行代碼時,都會出現錯誤。代碼如下。AS3中的按鈕移動控制錯誤

stop() 
up_btn.addEventListener(MouseEvent.CLICK, fl_up); 

function fl_up() { 
     player.x += 5; 
} 

如果有人能告訴我什麼是錯與此代碼,將不勝感激。

回答

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; 
}