Did you know? DZone has great portals for Python, Cloud, NoSQL, and HTML5!
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 5886 posts at DZone. View Full User Profile

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

04.02.2006
Email
Views: 6117
  • 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");