Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populate combo box using loadVars();

Status
Not open for further replies.

MJB3K

Programmer
Jul 16, 2004
524
GB
Hi, i was wonderng how you populate a combo box using loadVars();

any ideas??

here is the code so far:

Code:
myLv = new LoadVars();
myLv.onLoad = function(success) {
	i = 1;
	if (success) {
		trace("amount of users: "+myLv.amnt);
		while (i<=myLv.amnt) {
		    _root.usrs.addItem(myLv.user);
		    i++;
		}
	}
};
myLv.load("[URL unfurl="true"]http://localhost/loadusernames.php");[/URL]

Regards,

Martin

Gaming Help And Info:
 
Did you try creating an array with the loadVars object? Maybe this will work...

Code:
myArray = new Array();
myVars = new LoadVars();
myVars.onLoad = function(success){
	if(success){
		i=0;
		for(var name in myVars){
			myArray[i] = myVars[name];
			i++;
		}
	}else{
		trace("didn't work");
	}
	theCombo.dataProvider = myArray;
}
myVars.load("vars.txt");

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top