View Full Version : loadvars & comboBox

10-29-2002, 03:03 PM
I'm not sure where this query should be AS, MX or....
I have done a search under the thread title and came up with a response by tg, which was in fact like a mini tute, unfortunately, it doesn't go quite far enough.

I want to load a list of countries from a txt file into a comboBox,
so far I have this code :

myCountries = new LoadVars();
myCountries.onLoad = addCountries;

function addCountries() {
for (var i=0; i<myCountries.numCountries; i++) {

All I am getting is a list of 27 commas ?
I wonder if the problem may be in the text file, as the countries will also link to a web service fro exchange rate purposes, so the list in my txt file looks a bit like this :

&name0=United States&value0=usa&

and so on for 27 names

What should I change to load in the Countries.txt into my comboBox, and will I need to create a seperate file for the currency conversion ?



10-29-2002, 03:32 PM
this might do it:

function addCountries(success) {
if (success) {
for (var i=0; i<this.numCountries; i++) {
_root.resident.addItem(this["name"+i], this["value"+i]);
} else {
//it's worth checking that they're loaded...

any help?

10-29-2002, 03:36 PM
Thanks Jim, it worked a treat