Data Model Flex



    
        
            private var _countriesService:URLLoader;
            private var _statesService:URLLoader;
            private function initializeHandler(event:Event):void {
                _countriesService = new URLLoader();
                _countriesService.addEventListener(Event.COMPLETE, countriesCompleteHandler);
                _countriesService.load(new URLRequest("http://localhost/countries.xml"));
            }
            private function countriesCompleteHandler(event:Event):void {
                var xml:XML = new XML(_countriesService.data);
                country.dataProvider = xml.children();
            }
   
            private function changeHandler(event:Event):void {
                var request:URLRequest = new URLRequest("http://localhost/state.php");
                var parameters:URLVariables = new URLVariables();
                parameters.country = country.value;
                request.data = parameters;
                _statesService.load(request);
            }