我目前正在学习动作脚本 3,但我遇到了一个问题,只是希望有人引导我了解我做错了什么或向我解释。我试图做的是将一组可能的密码与正确的密码匹配,并跟踪密码是否正确。这就是我到目前为止所拥有的。
var passWords:Array = ["catdog", "fatcow", "yoda", "petergriffin"];
var userPassword:String = "petergriffin";
var wrongPassword:Boolean = false;
for each(var p:String in passWords)//checking each possible password for correct match
{
if(p == userPassword)
{
trace("The password was found in the list");
}
}