Error in Retrieving XML data into ArrayCollection through HTTPService in FLEX

Dvir130

New Member
I a new here and a novice developer in FLEX 4.I m trying to retrieve XML data into an ArrayCollection class by usint HTTPService. But Im getting an Error Message "Http Request Error"I want to solve it elegantly. Any recommendation.??Here is the XML code.\[code\]<?xml version="1.0" encoding="utf-8"?><products> <product id="p1"> <name>1100</name> <manufacturer>Nokia</manufacturer> <price>2000</price> <imageURL>1100.jpg</imageURL> <description>Nokia 1100</description> </product> <product id="p2"> <name>1110</name> <manufacturer>Nokia</manufacturer> <price>2100</price> <imageURL>1110.jpg</imageURL> <description>Nokia 1110</description> </product></products>\[/code\]And here is a Source file:\[code\]<?xml version="1.0" encoding="utf-8"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="httpService.send();"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> <mx:HTTPService id="httpService" url="assets/products.xml" resultFormat="object" fault="httpService_fault(event)" result="httpService_result(event)" /> </fx:Declarations> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; public var dataObj:ArrayCollection; public var alert:Alert; private function httpService_result(event:ResultEvent):void { dataObj = new ArrayCollection(event.result.products.product); } private function httpService_fault(event:FaultEvent):void { Alert.show(event.fault.faultString, event.fault.faultCode); } ]]> </fx:Script></s:Application>\[/code\]
 
Back
Top