1 Reply Latest reply on Jan 13, 2007 1:02 PM by mburbidg

    List Control and XML data

    mburbidg
      I am trying to display XML data from a HTTPReqeust in a list control. Here's my mxml:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="aircrafts.send()">

      <mx:Script>
      <![CDATA[
      import mx.collections.XMLListCollection;
      import mx.rpc.events.ResultEvent;

      [Bindable]
      private var aircraftDp:XMLList;

      private function aircraftXMLHandler(event:ResultEvent):void
      {
      aircraftDp = event.result.aircraft;
      }
      ]]>
      </mx:Script>

      <mx:HTTPService id="aircrafts"
      url=" http://localhost:8080/flysafe/aircrafts"
      result="aircraftXMLHandler(event)"
      resultFormat="e4x"/>

      <mx:List x="10" y="53" dataProvider="{aircraftDp}"></mx:List>
      </mx:Application>

      The REST service returns the following XML document:

      <aircrafts>
      <aircraft id='0' label='Cessna' href=' http://localhost:8080/flysafe/aircrafts/0'/>
      <aircraft id='1' label='Piper' href=' http://localhost:8080/flysafe/aircrafts/1'/>
      </aircrafts>

      The List control is empty. I cannot figure out how to get the right connection between the data provider and the xml returned by the HTTPRequest.