View Full Version : How is externel text file loaded into TextArea?

03-11-2005, 10:03 AM
Hi, Flash gurus,

I want to ask how could I use TextArea component for loading HTML formating text from externel .txt file (or other text containing file format)?

If it is possible, write step-by-step tutorial, because I have only "under basic" knowledges about how Flash works :o.

P.S. Sorry for possable grammatical mistakes. English is not my native language :o .



03-14-2005, 04:19 PM
PLace the textArea component on the stage and place this as on the first frame of the movie (instructions are in the script):

myLoadVar = new LoadVars();
// place the complete path to the txt file to be loaded
// where it says "text file goes here" (between quotes)
myLoadVar.load("text file goes here");
myLoadVar.onLoad = function(success) {
if (success == true) {
// write the instance name of the textArea component
// in place of urMC in the followinf lines. Where it says VARIABLE, place the name
// of the variable you want to be loaded from the txt file.
// For example, you have a txt file and in it you have:
// text = my wourld --- "text" would be the VARIABLE
// and anything after the equal sign would be what would be
// loaded to your textArea component.
urMC.text = myLoadVar.VARIABLE;
urMC.html = true;