Wednesday, March 13, 2013

Flex Http result into Array Collection

HttpService has two event hanlders (mostly used)

a) RESULT_EVENT
b) FAULT_EVENT

example:

private var http:HttpService;
private var ac:ArrayCollection;

private function init():void
{
        http = new HttpService();
        http.method = "POST";
        http.URL = "....";
        http.addEventListener(ResultEvent.RESULT, success);
        http.send();
}

private function success(event:ResultEvent):void
{
      Alert.show("Success");
      ac = event.result.root.base;
}


where my incoming xml looks like 

<root>
      <base>.....</base>
      <base>.....</base>
      <base>.....</base>
....
</root>

No comments:

Post a Comment