Thanks for your reply.
Well I found the components that you mentioned which create the combobox automatically and i got a code from other source which I think is more simple and I can understand abit and the original file is look like
this.
- Code: Select all
//
//Populate ISO Country Codes & US States in Combo Box
//
countries = "Andorra, Principality of |United Arab Emirates|Afghanistan, Islamic State of|Antigua and Barbuda |Anguilla|Albania|Armenia|Netherlands Antilles|Angola |Antarctica |Argentina |Old style Arpanet|American Samoa|Austria|Australia |Aruba |...";
countrycodes = "AD|AE|AF|AG|AI|AL|AM|AN|AO|AQ|AR|ARPA|AS|AT|AU|...";
usstates = "none|AL|AK|AZ|AR|AP|CA|CO|CT|DE|DC|FL|GA|HI|ID|...";
aISOCountries = countries.split("|");
aISOCountryCodes = countrycodes.split("|");
aUSStates = usstates.split("|");
//Populate Combo Box
for (i=0; i<aISOCountries.length; i++) {
cbCountry.addItemAt(i, aISOCountries[i], aISOCountryCodes[i]);
}
//USA = 234
cbCountry.setSelectedIndex("234");
// sort the list
cbCountry.sortItemsBy("Label", "ASC");
//Populate Combo Box
for (i=0; i<aUSStates.length; i++) {
cbUSState.addItemAt(i, aUSStates[i], aUSStates[i]);
}
// Sort the List
cbUSState.sortItemsBy("Label", "ASC");
cbCountry.setChangeHandler("sendCountryToTextBox")
cbUSState.setChangeHandler("sendStateToTextBox")
function sendCountryToTextBox() {
_root.txtCountry = "country = "+cbCountry.getValue();
}
function sendStateToTextBox() {
_root.txtState = "state = "+cbUSState.getValue();
}
I'm not so profesional i using the actionscript. From this code, the thing that I know is where to change the country and state. But the states is showing all the time, not shown base on the country that the user select.
Can anyone edit it for me or have any other suggestion code for this combobox?