[ANN] Quickie Tutorial | Populating a ComboBox Component With Countries in Flash MX 2004 / Flash 8

A really simple Flash method for you, but one that will save you a lot of time when designing form based flash applications…the country combobox. Sounds simple, it is, but rather than painfully populating a combobox component with over a hundred different countries, use the dataprovider and a simple array instead and you have already saved yourself many minutes of typing in data.

Quickie | Populating a ComboBox Component With Countries

A really simple Flash method for you, but one that will save you a lot of time when designing form based flash applications…the country combobox. Sounds simple, it is, but rather than painfully populating a combobox component with over a hundred different countries, use the dataprovider and a simple array instead and you have already saved yourself many minutes of typing in data (see below).

  1. Create a new flash document.
  2. Drag a combobox component from the Components Panel to the first frame of the default layer. Name the instance ‘countries’.
  3. Select the first frame of the default layer and add the following code within the Actions Panel. Save your FLA and preview to view a super simple timesaving combobox!

//*** Create Array
var countryArray:Array = new Array('Afghanistan', 'Albania ', 'Algeria ', 'Andorra ', 'Angola ', 'Antarctica', 'Antigua and Barbuda ', 'Argentina ', 'Armenia ', 'Aruba ', 'Australia ', 'Austria ', 'Azerbaijan ', 'Bahamas, The ', 'Bahrain ', 'Bangladesh ', 'Barbados ', 'Belarus ', 'Belgium ', 'Belize ', 'Benin ', 'Bhutan ', 'Bolivia ', 'Bosnia and Herzegovina ', 'Botswana ', 'Brazil ', 'Brunei ', 'Bulgaria ', 'Burkina Faso ', 'Burundi ', 'Cambodia ', 'Cameroon ', 'Canada ', 'Cape Verde ', 'Central African Republic ', 'Chad ', 'Chile ', 'China ', 'Colombia ', 'Comoros ', 'Congo (Brazzaville) ', 'Congo, Democratic Republic of the ', 'Costa Rica ', 'Croatia ', 'Cuba ', 'Cyprus ', 'Czech Republic ', 'Côte d Ivoire (Ivory Coast) ', 'Denmark ', 'Djibouti ', 'Dominica ', 'Dominican Republic ', 'East Timor (Timor Timur) ', 'Ecuador ', 'Egypt ', 'El Salvador ', 'Equatorial Guinea ', 'Eritrea ', 'Estonia ', 'Ethiopia ', 'Fiji ', 'Finland ', 'France ', 'Gabon ', 'Gambia, The ', 'Georgia ', 'Germany ', 'Ghana ', 'Greece', 'Grenada ', 'Guatemala ', 'Guinea ', 'Guinea-Bissau ', 'Guyana ', 'Haiti ', 'Honduras ', 'Hungary ', 'Iceland ', 'India ', 'Indonesia ', 'Iran ', 'Iraq ', 'Ireland ', 'Israel ', 'Italy ', 'Jamaica ', 'Japan ', 'Jordan ', 'Kazakhstan ', 'Kenya ', 'Kiribati ', 'Korea, North ', 'Korea, South ', 'Kuwait ', 'Kyrgyzstan ', 'Laos ', 'Latvia ', 'Lebanon ', 'Lesotho ', 'Liberia ', 'Libya ', 'Liechtenstein ', 'Lithuania ', 'Luxembourg ', 'Macedonia, Former Yugoslav Republic of ', 'Madagascar ', 'Malawi ', 'Malaysia ', 'Maldives ', 'Mali ', 'Malta ', 'Marshall Islands ', 'Mauritania ', 'Mauritius ', 'Mexico ', 'Micronesia, Federated States of ', 'Moldova ', 'Monaco ', 'Mongolia ', 'Morocco ', 'Mozambique ', 'Myanmar ', 'Namibia ', 'Nepal ', 'Netherlands ', 'New Zealand ', 'Nicaragua ', 'Niger ', 'Nigeria ', 'Norway ', 'Oman ', 'Pakistan ', 'Palau ', 'Panama ', 'Papua New Guinea ', 'Paraguay ', 'Peru ', 'Philippines ', 'Poland ', 'Portugal ', 'Qatar ', 'Romania ', 'Russia ', 'Rwanda ', 'Saint Lucia ', 'Samoa ', 'San Marino ', 'Saudi Arabia ', 'Senegal ', 'Seychelles ', 'Sierra Leone ', 'Singapore ', 'Slovakia ', 'Slovenia ', 'Solomon Islands ', 'Somalia ', 'South Africa ', 'Spain ', 'Sri Lanka ', 'Sudan ', 'Suriname ', 'Swaziland ', 'Sweden ', 'Switzerland ', 'Syria ', 'Taiwan ', 'Tajikistan ', 'Tanzania ', 'Thailand ', 'Togo ', 'Tonga ', 'Trinidad and Tobago ', 'Tunisia ', 'Turkey, Republic of ', 'Turkmenistan ', 'Uganda ', 'Ukraine ', 'United Arab Emirates ', 'United Kingdom ', 'United States ', 'Uruguay ', 'Uzbekistan ', 'Vatican City ', 'Venezuela ', 'Vietnam ', 'Yemen ', 'Yugoslavia (Serbia and Montenegro) ', 'Zaire ', 'Zambia ', 'Zimbabwe ');
//*** Sort Array

countryArray.sort()

//*** Assign dataProvider

countries.dataProvider = countryArray;