# MX2004 & external .txt files

**URL:** <https://forum.kirupa.com/t/mx2004-external-txt-files/115017>\
**Category:** Uncategorized\
**Created:** [July 4, 2004, 6:13pm UTC](https://forum.kirupa.com/t/mx2004-external-txt-files/115017 "2004-07-04T18:13:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![undiminished](https://avatars.discourse-cdn.com/v4/letter/u/b9e5f3/32.png) [@undiminished](https://forum.kirupa.com/u/undiminished)\
**Post date:** [July 4, 2004, 6:13pm UTC](https://forum.kirupa.com/t/mx2004-external-txt-files/115017/1 "2004-07-04T18:13:32Z")

</div>

:puzzled: this is bugging me because it _nearly_ does what i want…

i’ve got my HTML text loaded from the .txt file, & formatted from the .css OK, but the link to another .txt doesn’t work… unless i click it _twice_

what am i doing wrong??

(nb i’m new to this, MX2004 is where i came in…)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 5, 2004, 12:28pm UTC](https://forum.kirupa.com/t/mx2004-external-txt-files/115017/2 "2004-07-05T12:28:31Z")

</div>

aha! the actionscript wasn’t waiting for the variables to load before… it works if i add:

[font=Fixedsys]\_level0.onData=function(){[/font]

…in the line before:

[font=Fixedsys]display\_txt.htmlText =HTMLpage;[/font]  
[font=Fixedsys][/font]  
[font=Fixedsys][font=Arial]…in the .fla posted above.[/font][/font]

alternatively, a colleague has suggested doing the following instead, it’s another method of acheiving the same result:

[font=Fixedsys]function myFunction(file\_name) {  
var newFile = new LoadVars(); [/font]  
[font=Fixedsys]newFile.onLoad = function(ok) { [/font]  
[font=Fixedsys]if (ok) { [/font]  
[font=Fixedsys]display\_txt.htmlText=newFile.HTMLpage [/font]  
[font=Fixedsys]}  
};  
newFile.load(file\_name); [/font]  
[font=Fixedsys]}[/font]

so, problem solved! but, can someone explain why ‘loadVars’ might be preferable to another?
