我有三个不同的按钮。当您单击其中一个按钮时,它应该激活 stageSelect 功能,然后应该输出按钮的编号。
但是当我这样做时,我得到了标题中的错误。我在这里做错了什么?
package {
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.ui.Mouse;
public class MenuScreen extends MovieClip {
public function MenuScreen() {
Mouse.show();
selectGrass.addEventListener(MouseEvent.CLICK, stageSelect, 1);
selectDirt.addEventListener(MouseEvent.CLICK, stageSelect, 2);
selectGravel.addEventListener(MouseEvent.CLICK, stageSelect, 3);
}
public function stageSelect(stageID:Number) {
trace(stageID);
}
}
}