[Bindable]private var arrayCollection:ArrayCollection;
Rx.http(function(result:XML):void {
arrayCollection = convertXml(result);
list.dataProvider = arrayCollection;
}).invoke("offers.fxml");
public static function toArray(obj:Object):Array {
if (!obj)
return [];
else if (obj is Array)
return obj as Array;
else
return [ obj ];
}
private function convertXml(file:String):ArrayCollection {
var xml:XMLDocument = new XMLDocument(file);
var decoder:SimpleXMLDecoder = new SimpleXMLDecoder();
var data:Object = decoder.decodeXML(xml);
var array:Array = data == null ? new Array() : toArray(data.offers.offer);
return new ArrayCollection(array);
}