I am trying to load two variables from a text file testi.txt
Here’s my file (test1=here is some text&test2=OK)
I have no problems loading test1 -part to dynamic text field but the second variable (test2) is giving me troubles.
Here’s the code:
myText = new LoadVars();
myText.load("testi.txt");
myText.onLoad = function(success) {
if (success == true) {
test1.htmlText = this.test1;
test2.text = this.test2;
trace (test1.htmlText); // all OK at this point
trace (test2.text); // all OK at this point
}
}
// now comes the problem part
if (testi2.text == “OK”) {
trace (“I expected this to be true with my test2 value being OK”);
} else {
trace (“but for some reason it is not”);
};
Why is my if/else loop failing me? Even when test2 value is “OK” it still doesn’t work? Is it because I am loading data from an external source?
I tried to solve the problem by adding a third variable; test3 to my string (test1=here is some text&test2=OK&test3=EOF) but that didn’t help.