Use URLLoader to load XML data from server
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initializeHandler(event)">
<mx:Script>
private var _myService:URLLoader;
private function initializeHandler(event:Event):void {
_myService = new URLLoader( );
_myService.addEventListener(Event.COMPLETE,myCompleteHandler);
_myService.load(new URLRequest("http://localhost/my.xml"));
XML.ignoreWhitespace = true;
}
private function myCompleteHandler(event:Event):void {
var xml:XML = new XML(_myService.data);
myComboBox.dataProvider = xml.children( );
}
</mx:Script>
<mx:VBox>
<mx:ComboBox id="myComboBox" />
</mx:VBox>
</mx:Application>
Related examples in the same category