Flash Gordon
03-23-2005, 12:04 AM
here is my code:
var info:Array = [["John", "919-555-5698"], ["Kelly", "232-555-3333"], ["Ross", "434-555-5655"]];
function search() {
var matchFound:Boolean = false;
var i:Number = -1;
while (++i<info.length) {
if (info[i][0].toLowerCase() != name_txt.text.toLowerCase()) {
continue;
}
result_txt.text = info[i][1];
matchFound = true;
break;
}
if (matchFound == false) {
result_txt.text = "No Match";
}
}
search_btn.onRelease = search;
I don't understand what continue; does. Wont it "continue" looping anyway because i is < 3?
var info:Array = [["John", "919-555-5698"], ["Kelly", "232-555-3333"], ["Ross", "434-555-5655"]];
function search() {
var matchFound:Boolean = false;
var i:Number = -1;
while (++i<info.length) {
if (info[i][0].toLowerCase() != name_txt.text.toLowerCase()) {
continue;
}
result_txt.text = info[i][1];
matchFound = true;
break;
}
if (matchFound == false) {
result_txt.text = "No Match";
}
}
search_btn.onRelease = search;
I don't understand what continue; does. Wont it "continue" looping anyway because i is < 3?