MX2004 & external .txt files

: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…)

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


…in the line before:

[font=Fixedsys]display_txt.htmlText =HTMLpage;[/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]
newFile.load(file_name); [/font]

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