DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Reading A Field Value From A Text File Using LoadVars()

04.02.2006
| 7579 views |
  • submit to reddit
        // description of your code here

Provided a file called mytextfile.txt containing the following line:
------------------------------------
firstname=harold&lastname=mike
-----------------------------------
The following code load into the value of field firstname into a dynamic text instance.

var nameVars= new LoadVars();
nameVars.onLoad=function(ok) {
	if(ok)
	{   
	    trace("Loading");
		text_var=nameVars.firstname;
	}
};
nameVars.load("mytextfile.txt");