<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:dropdown="components.*" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ private function handleCountryChange():void { countryCB.selectedValue=Country.text.toUpperCase(); switch (Country.text.toUpperCase()){ case "US": stateCB.enabled = true; stateCB.xmlFile = "xml/States.xml"; handleStateChange(); break; case "CA": stateCB.enabled = true; stateCB.xmlFile = "xml/CanadaProvinces.xml"; handleStateChange(); break; default: if (stateCB.xmlFile != "xml/Empty.xml") stateCB.xmlFile = "xml/Empty.xml"; stateCB.enabled = false; break; } } private function handleStateChange():void { stateCB.selectedValue=StateProv.text.toUpperCase(); } ]]> </mx:Script> <mx:Label text="Country"/> <dropdown:XMLComboBox id="countryCB" xmlFile="xml/Countries.xml" change="Country.text=countryCB.selectedItem.@data;handleCountryChange();"/> <mx:Label text="State/Province"/> <dropdown:XMLComboBox id="stateCB" xmlFile="xml/States.xml" selectedValue="CA" change="StateProv.text=stateCB.selectedItem.@data;"/> <mx:Label text="Country Code"/> <mx:TextInput id="Country" text="US" change="handleCountryChange()"/> <mx:Label text="State/Province Code"/> <mx:TextInput id="StateProv" text="CA" change="handleStateChange()"/> </mx:Application>