all groups > flash actionscript > october 2004 >
You're in the

flash actionscript

group:

problem with text from a file


problem with text from a file myselfandi
10/23/2004 5:57:12 PM
flash actionscript:
hello.
how can I make a textbox read text from a file so that it will read only a
certain part of the text without reading the rest,
and then create a second textox that will read the rest without the begining?
thanks.
Re: problem with text from a file _jrh_
10/23/2004 7:32:09 PM
Use loadVariables. This will create separate variables for separate parts of
your text files. For example, put this in your text file (call it test.txt, and
stick it in the same folder as your fla):

name=Somebody&location=Somewhere

Then put this in your actionscript:

myLV = new LoadVars();
myLV.onLoad = function(success) {
if (success) {
trace(myLV.name); // outputs "Someone"
trace(myLV.location); // outputs "Somewhere"
} else {
trace("could not load text file");
}
}
myLV.load("test.txt");

LoadVars creates an object from your text file, and you just have to reference
it like it's an object.
Re: problem with text from a file myselfandi
10/23/2004 7:36:53 PM
Re: problem with text from a file _jrh_
10/23/2004 7:39:50 PM
AddThis Social Bookmark Button