Actionscript 3 条件和运算符的错误行为

Actionscript 3 条件和运算符的错误行为,actionscript-3,operators,conditional-statements,Actionscript 3,Operators,Conditional Statements,我已经完成了以下迭代: The content of the array respuesta is: Africa, Europa, Norteamerica The content of the array resultado is: Incorrect, Correct, Incorrect I created a Array to include both of them: var contPre:Array = [ this.respuesta, this.

我已经完成了以下迭代:

The content of the array respuesta is: Africa, Europa, Norteamerica The content of the array resultado is: Incorrect, Correct, Incorrect I created a Array to include both of them: var contPre:Array = [ this.respuesta, this.resultado ]; for (var a:uint = 0; a < contPre[0].length; a++){ if (this.radioGroup1.selection.value == contPre[0][a] && contPre[1][a] == "Correcto") { result_txt.text = "Correct"; valor = 1; } else { result_txt.text = "Incorrect"; valor = 0; } } The first time that I've executed this I found this: this.radioGroup1.selection.value Obtained value: Europa contPre[0][a]: Obtained value: Europa contPre[1][a]: Obtained value: Correcto The sentence go out for the second option "Incorrect". Somebody can explain why is this happening?
问题是,当你找到正确的答案时,你并没有脱离循环。因此,改变:

if (this.radioGroup1.selection.value == contPre[0][a] && contPre[1][a] == "Correcto") {
    result_txt.text = "Correct";
    valor = 1;
}
进入:

if (this.radioGroup1.selection.value == contPre[0][a] && contPre[1][a] == "Correcto") {
    result_txt.text = "Correct";
    valor = 1;
    break; // Add this line
}