Skip to content

Instantly share code, notes, and snippets.

@MindScriptAct
Created November 17, 2016 17:29
Show Gist options
  • Save MindScriptAct/b4f33e768351851c13bd2a212e3937f4 to your computer and use it in GitHub Desktop.
Save MindScriptAct/b4f33e768351851c13bd2a212e3937f4 to your computer and use it in GitHub Desktop.
package {
import flash.utils.Dictionary;
/**
* Contains country codes and names.
*/
public class Country {
public static var allCountries:Dictionary = new Dictionary();
{
Country.allCountries["AND"] = "Andorra";
Country.allCountries["ARE"] = "United Arab Emirates";
Country.allCountries["AFG"] = "Afghanistan";
Country.allCountries["ATG"] = "Antigua and Barbuda";
Country.allCountries["AIA"] = "Anguilla";
Country.allCountries["ALB"] = "Albania";
Country.allCountries["ARM"] = "Armenia";
Country.allCountries["AGO"] = "Angola";
Country.allCountries["ATA"] = "Antarctica";
Country.allCountries["ARG"] = "Argentina";
Country.allCountries["ASM"] = "American Samoa";
Country.allCountries["AUT"] = "Austria";
Country.allCountries["AUS"] = "Australia";
Country.allCountries["ABW"] = "Aruba";
Country.allCountries["ALA"] = "Åland Islands";
Country.allCountries["AZE"] = "Azerbaijan";
Country.allCountries["BIH"] = "Bosnia and Herzegovina";
Country.allCountries["BRB"] = "Barbados";
Country.allCountries["BGD"] = "Bangladesh";
Country.allCountries["BEL"] = "Belgium";
Country.allCountries["BFA"] = "Burkina Faso";
Country.allCountries["BGR"] = "Bulgaria";
Country.allCountries["BHR"] = "Bahrain";
Country.allCountries["BDI"] = "Burundi";
Country.allCountries["BEN"] = "Benin";
Country.allCountries["BLM"] = "Saint Barthélemy";
Country.allCountries["BMU"] = "Bermuda";
Country.allCountries["BRN"] = "Brunei Darussalam";
Country.allCountries["BOL"] = "Bolivia, Plurinational State of";
Country.allCountries["BES"] = "Bonaire, Sint Eustatius and Saba";
Country.allCountries["BRA"] = "Brazil";
Country.allCountries["BHS"] = "Bahamas";
Country.allCountries["BTN"] = "Bhutan";
Country.allCountries["BVT"] = "Bouvet Island";
Country.allCountries["BWA"] = "Botswana";
Country.allCountries["BLR"] = "Belarus";
Country.allCountries["BLZ"] = "Belize";
Country.allCountries["CAN"] = "Canada";
Country.allCountries["CCK"] = "Cocos (Keeling) Islands";
Country.allCountries["COD"] = "Congo, The Democratic Republic of the";
Country.allCountries["CAF"] = "Central African Republic";
Country.allCountries["COG"] = "Congo";
Country.allCountries["CHE"] = "Switzerland";
Country.allCountries["CIV"] = "Côte d'Ivoire";
Country.allCountries["COK"] = "Cook Islands";
Country.allCountries["CHL"] = "Chile";
Country.allCountries["CMR"] = "Cameroon";
Country.allCountries["CHN"] = "China";
Country.allCountries["COL"] = "Colombia";
Country.allCountries["CRI"] = "Costa Rica";
Country.allCountries["CUB"] = "Cuba";
Country.allCountries["CPV"] = "Cape Verde";
Country.allCountries["CUW"] = "Curaçao";
Country.allCountries["CXR"] = "Christmas Island";
Country.allCountries["CYP"] = "Cyprus";
Country.allCountries["CZE"] = "Czech Republic";
Country.allCountries["DEU"] = "Germany";
Country.allCountries["DJI"] = "Djibouti";
Country.allCountries["DNK"] = "Denmark";
Country.allCountries["DMA"] = "Dominica";
Country.allCountries["DOM"] = "Dominican Republic";
Country.allCountries["DZA"] = "Algeria";
Country.allCountries["ECU"] = "Ecuador";
Country.allCountries["EST"] = "Estonia";
Country.allCountries["EGY"] = "Egypt";
Country.allCountries["ESH"] = "Western Sahara";
Country.allCountries["ERI"] = "Eritrea";
Country.allCountries["ESP"] = "Spain";
Country.allCountries["ETH"] = "Ethiopia";
Country.allCountries["FIN"] = "Finland";
Country.allCountries["FJI"] = "Fiji";
Country.allCountries["FLK"] = "Falkland Islands (Malvinas)";
Country.allCountries["FSM"] = "Micronesia, Federated States of";
Country.allCountries["FRO"] = "Faroe Islands";
Country.allCountries["FRA"] = "France";
Country.allCountries["GAB"] = "Gabon";
Country.allCountries["GBR"] = "United Kingdom";
Country.allCountries["GRD"] = "Grenada";
Country.allCountries["GEO"] = "Georgia";
Country.allCountries["GUF"] = "French Guiana";
Country.allCountries["GGY"] = "Guernsey";
Country.allCountries["GHA"] = "Ghana";
Country.allCountries["GIB"] = "Gibraltar";
Country.allCountries["GRL"] = "Greenland";
Country.allCountries["GMB"] = "Gambia";
Country.allCountries["GIN"] = "Guinea";
Country.allCountries["GLP"] = "Guadeloupe";
Country.allCountries["GNQ"] = "Equatorial Guinea";
Country.allCountries["GRC"] = "Greece";
Country.allCountries["SGS"] = "South Georgia and the South Sandwich Islands";
Country.allCountries["GTM"] = "Guatemala";
Country.allCountries["GUM"] = "Guam";
Country.allCountries["GNB"] = "Guinea-Bissau";
Country.allCountries["GUY"] = "Guyana";
Country.allCountries["HKG"] = "Hong Kong";
Country.allCountries["HMD"] = "Heard Island and McDonald Islands";
Country.allCountries["HND"] = "Honduras";
Country.allCountries["HRV"] = "Croatia";
Country.allCountries["HTI"] = "Haiti";
Country.allCountries["HUN"] = "Hungary";
Country.allCountries["IDN"] = "Indonesia";
Country.allCountries["IRL"] = "Ireland";
Country.allCountries["ISR"] = "Israel";
Country.allCountries["IMN"] = "Isle of Man";
Country.allCountries["IND"] = "India";
Country.allCountries["IOT"] = "British Indian Ocean Territory";
Country.allCountries["IRQ"] = "Iraq";
Country.allCountries["IRN"] = "Iran, Islamic Republic of";
Country.allCountries["ISL"] = "Iceland";
Country.allCountries["ITA"] = "Italy";
Country.allCountries["JEY"] = "Jersey";
Country.allCountries["JAM"] = "Jamaica";
Country.allCountries["JOR"] = "Jordan";
Country.allCountries["JPN"] = "Japan";
Country.allCountries["KEN"] = "Kenya";
Country.allCountries["KGZ"] = "Kyrgyzstan";
Country.allCountries["KHM"] = "Cambodia";
Country.allCountries["KIR"] = "Kiribati";
Country.allCountries["COM"] = "Comoros";
Country.allCountries["KNA"] = "Saint Kitts and Nevis";
Country.allCountries["PRK"] = "Korea, Democratic People's Republic of";
Country.allCountries["KOR"] = "Korea, Republic of";
Country.allCountries["KWT"] = "Kuwait";
Country.allCountries["CYM"] = "Cayman Islands";
Country.allCountries["KAZ"] = "Kazakhstan";
Country.allCountries["LAO"] = "Lao People's Democratic Republic";
Country.allCountries["LBN"] = "Lebanon";
Country.allCountries["LCA"] = "Saint Lucia";
Country.allCountries["LIE"] = "Liechtenstein";
Country.allCountries["LKA"] = "Sri Lanka";
Country.allCountries["LBR"] = "Liberia";
Country.allCountries["LSO"] = "Lesotho";
Country.allCountries["LTU"] = "Lithuania";
Country.allCountries["LUX"] = "Luxembourg";
Country.allCountries["LVA"] = "Latvia";
Country.allCountries["LBY"] = "Libya";
Country.allCountries["MAR"] = "Morocco";
Country.allCountries["MCO"] = "Monaco";
Country.allCountries["MDA"] = "Moldova, Republic of";
Country.allCountries["MNE"] = "Montenegro";
Country.allCountries["MAF"] = "Saint Martin (French part)";
Country.allCountries["MDG"] = "Madagascar";
Country.allCountries["MHL"] = "Marshall Islands";
Country.allCountries["MKD"] = "Macedonia, Republic of";
Country.allCountries["MLI"] = "Mali";
Country.allCountries["MMR"] = "Myanmar";
Country.allCountries["MNG"] = "Mongolia";
Country.allCountries["MAC"] = "Macao";
Country.allCountries["MNP"] = "Northern Mariana Islands";
Country.allCountries["MTQ"] = "Martinique";
Country.allCountries["MRT"] = "Mauritania";
Country.allCountries["MSR"] = "Montserrat";
Country.allCountries["MLT"] = "Malta";
Country.allCountries["MUS"] = "Mauritius";
Country.allCountries["MDV"] = "Maldives";
Country.allCountries["MWI"] = "Malawi";
Country.allCountries["MEX"] = "Mexico";
Country.allCountries["MYS"] = "Malaysia";
Country.allCountries["MOZ"] = "Mozambique";
Country.allCountries["NAM"] = "Namibia";
Country.allCountries["NCL"] = "New Caledonia";
Country.allCountries["NER"] = "Niger";
Country.allCountries["NFK"] = "Norfolk Island";
Country.allCountries["NGA"] = "Nigeria";
Country.allCountries["NIC"] = "Nicaragua";
Country.allCountries["NLD"] = "Netherlands";
Country.allCountries["NOR"] = "Norway";
Country.allCountries["NPL"] = "Nepal";
Country.allCountries["NRU"] = "Nauru";
Country.allCountries["NIU"] = "Niue";
Country.allCountries["NZL"] = "New Zealand";
Country.allCountries["OMN"] = "Oman";
Country.allCountries["PAN"] = "Panama";
Country.allCountries["PER"] = "Peru";
Country.allCountries["PYF"] = "French Polynesia";
Country.allCountries["PNG"] = "Papua New Guinea";
Country.allCountries["PHL"] = "Philippines";
Country.allCountries["PAK"] = "Pakistan";
Country.allCountries["POL"] = "Poland";
Country.allCountries["SPM"] = "Saint Pierre and Miquelon";
Country.allCountries["PCN"] = "Pitcairn";
Country.allCountries["PRI"] = "Puerto Rico";
Country.allCountries["PSE"] = "Palestinian Territory, Occupied";
Country.allCountries["PRT"] = "Portugal";
Country.allCountries["PLW"] = "Palau";
Country.allCountries["PRY"] = "Paraguay";
Country.allCountries["QAT"] = "Qatar";
Country.allCountries["REU"] = "Réunion";
Country.allCountries["ROU"] = "Romania";
Country.allCountries["SRB"] = "Serbia";
Country.allCountries["RUS"] = "Russian Federation";
Country.allCountries["RWA"] = "Rwanda";
Country.allCountries["SAU"] = "Saudi Arabia";
Country.allCountries["SLB"] = "Solomon Islands";
Country.allCountries["SYC"] = "Seychelles";
Country.allCountries["SDN"] = "Sudan";
Country.allCountries["SWE"] = "Sweden";
Country.allCountries["SGP"] = "Singapore";
Country.allCountries["SHN"] = "Saint Helena, Ascension and Tristan da Cunha";
Country.allCountries["SVN"] = "Slovenia";
Country.allCountries["SJM"] = "Svalbard and Jan Mayen";
Country.allCountries["SVK"] = "Slovakia";
Country.allCountries["SLE"] = "Sierra Leone";
Country.allCountries["SMR"] = "San Marino";
Country.allCountries["SEN"] = "Senegal";
Country.allCountries["SOM"] = "Somalia";
Country.allCountries["SUR"] = "Suriname";
Country.allCountries["SSD"] = "South Sudan";
Country.allCountries["STP"] = "Sao Tome and Principe";
Country.allCountries["SLV"] = "El Salvador";
Country.allCountries["SXM"] = "Sint Maarten (Dutch part)";
Country.allCountries["SYR"] = "Syrian Arab Republic";
Country.allCountries["SWZ"] = "Swaziland";
Country.allCountries["TCA"] = "Turks and Caicos Islands";
Country.allCountries["TCD"] = "Chad";
Country.allCountries["ATF"] = "French Southern Territories";
Country.allCountries["TGO"] = "Togo";
Country.allCountries["THA"] = "Thailand";
Country.allCountries["TJK"] = "Tajikistan";
Country.allCountries["TKL"] = "Tokelau";
Country.allCountries["TLS"] = "Timor-Leste";
Country.allCountries["TKM"] = "Turkmenistan";
Country.allCountries["TUN"] = "Tunisia";
Country.allCountries["TON"] = "Tonga";
Country.allCountries["TUR"] = "Turkey";
Country.allCountries["TTO"] = "Trinidad and Tobago";
Country.allCountries["TUV"] = "Tuvalu";
Country.allCountries["TWN"] = "Taiwan, Province of China";
Country.allCountries["TZA"] = "Tanzania, United Republic of";
Country.allCountries["UKR"] = "Ukraine";
Country.allCountries["UGA"] = "Uganda";
Country.allCountries["UMI"] = "United States Minor Outlying Islands";
Country.allCountries["USA"] = "United States";
Country.allCountries["URY"] = "Uruguay";
Country.allCountries["UZB"] = "Uzbekistan";
Country.allCountries["VAT"] = "Holy See (Vatican City State)";
Country.allCountries["VCT"] = "Saint Vincent and the Grenadines";
Country.allCountries["VEN"] = "Venezuela, Bolivarian Republic of";
Country.allCountries["VGB"] = "Virgin Islands, British";
Country.allCountries["VIR"] = "Virgin Islands, U.S.";
Country.allCountries["VNM"] = "Viet Nam";
Country.allCountries["VUT"] = "Vanuatu";
Country.allCountries["WLF"] = "Wallis and Futuna";
Country.allCountries["WSM"] = "Samoa";
Country.allCountries["YEM"] = "Yemen";
Country.allCountries["MYT"] = "Mayotte";
Country.allCountries["ZAF"] = "South Africa";
Country.allCountries["ZMB"] = "Zambia";
Country.allCountries["ZWE"] = "Zimbabwe";
}
public function getNameByCode(countryCode:String):String {
var retVal:String = "";
if (Country.allCountries[countryCode] != null) {
retVal = Country.allCountries[countryCode];
}
return retVal;
}
public function getCodeByName(countryName:String):String {
var retVal:String = "";
for (var countryCode:String in Country.allCountries) {
if (Country.allCountries[countryCode] == countryName) {
retVal = countryCode;
break;
}
}
return retVal;
}
public function isCodeValid(countryCode:String):Boolean {
return Country.allCountries[countryCode] != null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment