1 Reply Latest reply on Jul 13, 2008 2:32 PM by ntsiii

    record count

    realtime158 Level 1
      Lets say you have the following data in a xml file called data.xml

      <records>
      <record data='1' label='Wal&#45;Mart Stores&#44; Inc&#46; &#40;Walmart&#41;' />
      <record data='5' label='Home Depot&#44; Inc&#46;'/>
      <record data='7' label='Microsoft'/>
      </records>

      Then you would use a HTTPService

      <mx:HTTPService id='getRecords' url='data.xml' useProxy='false' method='POST'>
      </mx:HTTPService>

      how do you get a record count of the amount of xml data returned.
        • 1. Re: record count
          ntsiii Level 3
          1. set resultFormat="e4x"
          2. Use a result handler: result="onResult(event)"
          3. With an empty post body, flex will send the request as a GET
          4. Watch out for caching, if your xml data ever changes.

          Example result handler:
          private function onResult(event:ResultEvent): void {
          var xmlResult:XML = XML(event.result);
          trace(xmlResult.toXMLString());
          vat xlRecords:XMLList = xmlResult.record;
          trace(xlRecords.length());
          }
          Tracy