1
我很抱歉提問,但我一直在閱讀其他1063錯誤,我無法將它們應用於我的問題。我仍然在AS3上進行深度潛水,當我回到它時,我感到分心了其他工作,我覺得像是出現了一個新問題。ArgumentError:錯誤#1063:MethodInfo-152()中的參數計數不匹配。預計1,得到3
我不知道爲什麼,這是行不通的,將不勝感激一些指導:
import flash.events.MouseEvent;
stop();
showNextButton(false);
var gift1_var:Number = 0;
var correct_new3:correct_q8 = new correct_q8;
var incorrect_new3:incorrect_q8 = new incorrect_q8;
var incorrect_new4:incorrect_q8 = new incorrect_q8;
var correct_new4:correct_q8 = new correct_q8;
var choices:Array = [
{
button: return_btn,
feedback_mc: correct_new3,
is_correct: true
},
{
button: give_btn,
feedback_mc: incorrect_new3,
is_correct: false
},
{
button: drink_btn,
feedback_mc: incorrect_new4,
is_correct: false
},
{
button: donate_btn,
feedback_mc: correct_new4,
is_correct: true
}
];
for (var i:int = 0; i < choices.length; i ++) {
var choice:Object = choices[i];
choice.button.addEventListener(MouseEvent.CLICK, onClick);
choice.button.buttonMode = true;
choice.button.obj = choice;
}
var num_selected:int = 0;
function onClick (evt:MouseEvent=null):void {
var btn:MovieClip = MovieClip(evt.currentTarget);
var choice:Object = btn.obj;
addChild(choice.feedback_mc);
choice.feedback_mc.x = btn.x;
choice.feedback_mc.y = btn.y;
if (choice.is_correct) {
gift1_var += 1;
}
addToSelected();
}
function addToSelected(evt:MouseEvent=null):void {
num_selected += 1;
if (num_selected === 2) {
showNextButton(true);
showButtons(false);
//trace("this worked");
}
}
function showNextButton (is_visible:Boolean):void {
MovieClip(root).next_mc.visible = is_visible;
}
function showButtons (is_visible:Boolean):void {
choices.forEach (function (choice:Object):void {
choice.button.visible = is_visible;
});
}
我不相信錯誤是在你顯示的代碼中,因爲我看不到任何你調用3個參數的方法。你是從Flash IDE運行的嗎?如果是這樣,如果你去設置並檢查'允許調試'選項,你應該能夠得到錯誤的行號。 – 2015-02-24 16:55:30