# Help with loading external text file

**URL:** <https://forum.kirupa.com/t/help-with-loading-external-text-file/247857>\
**Category:** Uncategorized\
**Created:** [December 31, 2007, 5:08am UTC](https://forum.kirupa.com/t/help-with-loading-external-text-file/247857 "2007-12-31T05:08:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tthdoc](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@tthdoc](https://forum.kirupa.com/u/tthdoc)\
**Post date:** [December 31, 2007, 5:08am UTC](https://forum.kirupa.com/t/help-with-loading-external-text-file/247857/1 "2007-12-31T05:08:36Z")

</div>

I have the following code with an external text file. The text file is passwords.txt with one line: content=thetext. If I put a trace (shown in this example) and click the enter button, the trace shows undefined. If I click retry and click the enter button again, the trace then shows thetext. Why is it showing undefined the first time you click it?

on (release, keyPress “\<Enter\>”) {  
var Passtest = new LoadVars();  
Passtest.onLoad = function(){  
firstpass = this.content;  
}  
Passtest.load(“passwords.txt”);  
trace(firstpass);  
if(password == firstpass){  
password="";  
getURL(“[http://www.xyz.com](http://www.xyz.com)”);  
} else {  
gotoAndStop(“wrong”);  
}  
}
