PDA

View Full Version : Reading text files



Fydus
December 2nd, 2004, 12:52 AM
I made a quick run over the tutorials and couldn't find how to read text in line by line. I need to do this so I can make saves during games I make so I can return to the game at the same spot I was at.

Anybody know how to read in text line by line?

Thanks

Fydus
December 4th, 2004, 04:45 PM
I don't think people understood what my question was -
I saw this on this tutorial under Flash mx
http://www.kirupa.com/developer/mx/externaldata.htm
------------------------In Text File------------------------
name=Kirupa Chinnathambi&email=blah@blah.com&location=Earth
------------------------In Flash File------------------------
loadText = new LoadVars();
loadText.load("data.txt");
loadText.onLoad = function() {
name.text = this.name;
email.text = this.email;
location.text = this.location;
};
------------------------------------------------------------
Is there a way to load the info from the text into an array?
By maybe having this in the text file-
"name =george,fred,henry"
and then declaring an array in the flash file
var names:array;
loadNames = new LoadVars();
loadNames.load("names.txt");
loadText.onLoad = function()
{
names = this.name;
}

Fydus
December 4th, 2004, 10:41 PM
What about setting cookies? Does anyone know how to write and read them?

Fydus
December 5th, 2004, 03:58 AM
I figured it out, I can use sharedObjects to do what I want it to do...
Thanks anyway