# \[FL8\] If/else loop fails when loading variables from .txt file

**URL:** <https://forum.kirupa.com/t/fl8-if-else-loop-fails-when-loading-variables-from-txt-file/193871>\
**Category:** flash\
**Created:** [July 18, 2006, 10:39pm UTC](https://forum.kirupa.com/t/fl8-if-else-loop-fails-when-loading-variables-from-txt-file/193871 "2006-07-18T22:39:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nastycut](https://avatars.discourse-cdn.com/v4/letter/n/6a8cbe/32.png) [@nastycut](https://forum.kirupa.com/u/nastycut)\
**Post date:** [July 18, 2006, 10:39pm UTC](https://forum.kirupa.com/t/fl8-if-else-loop-fails-when-loading-variables-from-txt-file/193871/1 "2006-07-18T22:39:23Z")

</div>

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.
