I am having a slight problem with my AS these days. I have 2 items on my stage, an input box with the var of "wordMatch"
A button
and a dynamic text field with the var of "matchWord"
uploaded to the server I have words.txt. inside words.txt it looks like this (example):
Code:
hi
hello
howdy
hola
What I am looking for is very simple I just can't manage to get it working:
I want the user to input a word in the txt box, click the button and have Flash check if it is in the list. If it IS in the list, then the dynamic text box says "Yay, it's in the list" and if not "Sorry it's not in the list"
Simple it seems, as nothing else needs to happen, I just can't get it to go correctly.
Any help?
~MoN
If I am wrong, please just correct me and move on.. there is no need for all that pointing and laughing! ~MoN
Here's a start, but it read from internal array, not txt file.
Code:
var txtList = new Array("hi", "hello", "howdy", "hola");
//
btn.onRelease = function() {
var foundIt = false;
for (var i = 0; i < txtList.length; i++) {
if (txtList[i] == wordMatch) {
foundIt = true;
break;
}
}
if (foundIt) {
matchWord = "Yay, it's in the list.";
} else {
matchWord = "Sorry it's not in the list.";
}
};