Load text file

i load external text file using below code:

on (release) {
loadText = new loadVars();
loadText.load(“certain.txt”);
loadText.onLoad = function() {
scroller.text = this.certaintext;
};
}

and there is 5 button, each button load different external text file.
now, my question is i want a preloader show up when i click the button.(in case the file size is big). i am not asking on how to do a preloader, but where should i put the preloader?

and, can we make the text inside the text file linkable? what i think is cannot, but i want to make sure from you guys.

Hope somebody help. THANX!

*Originally posted by toh *
**and there is 5 button, each button load different external text file.
now, my question is i want a preloader show up when i click the button.(in case the file size is big). i am not asking on how to do a preloader, but where should i put the preloader? **

onLoad does the job of preloading.

*Originally posted by toh *
can we make the text inside the text file linkable? what i think is cannot, but i want to make sure from you guys.

Sure, Insert the script below into your Flash Movie:

myLoadVars = new LoadVars();
myLoadVars.onLoad = function() {
	myTextBox.html = true;
	myTextBox.htmlText = this.LinkToKirupa;
};
myLoadVars.load("textfile.txt");

And this into your textfile:

LinkToKirupa=<a href="http://www.kirupaforum.com">Kirupa Forum</a>

h88 8]

Example:

really thanx h88 for solving this question.
but, how about the preloader. just like the bit-101.com, where when you click on the button, a preloader say LOADING xxx.txt before the text show up.

and according to the author of bit-101, the navigation is loaded from XML. how to do that? can someone show me, or where to find such kind of tutorial?

Thanks again,h88!

sorry to bother again.
the code you use will make the whole textbox become a link.
so, if my text file is :

“Go to Kirupa Forum and learn. Kirupa Forum is a great forum.”

and i just want to make the First Kirupa Forum linkable. How i gonna do this?

Oh well.

*Originally posted by toh *
**really thanx h88 for solving this question.
but, how about the preloader. just like the bit-101.com, where when you click on the button, a preloader say LOADING xxx.txt before the text show up. **

Well, You can do something like:

myTextBox.text = "Loading textfile.txt";
myLoadVars = new LoadVars();
myLoadVars.onLoad = function() {
    myTextBox.html = true;
    myTextBox.htmlText = this.LinkToKirupa;
};
myLoadVars.load("textfile.txt");

well, dont’t know what to say except THANX, h88!!
and i never thought that the code is so easy:P

so, anyone know how to solve the problem in my 2nd post?

Thank again, h88:P

what code should i use so that the “loading text.txt” will locate at the center of the textbox?

Hey,
did you figure this out yet?? cause there is a simple solution to this…

onEnterFrame = function(){
if(!myLoadVars.loaded){
msgTextBox = “loading”
}else{
msgTextBox = “done” // or u can make it nothing
}
}