2 Replies Latest reply on Mar 22, 2007 3:58 PM by chrisisme

    HTTPService with only one XML result

    chrisisme
      Working through and expanding on some tutorials I ran across an issue I can't resolve. Here is the brief code:

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

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

      [Bindable]
      private var myData:ArrayCollection;

      private function resultHandler(event:ResultEvent):void {
      myData = event.result.users.user;
      }
      ]]>
      </mx:Script>

      <mx:HTTPService id="myService" url=" http://localhost/httpservice/request.php" result="resultHandler(event)"/>

      <mx:DataGrid dataProvider="{myData}"/>

      </mx:Application>


      This works great... When there is more than one result returned by the php service. So I get that this is because I am using an ArrayCollection. Well then, how do you provide the flexability to have 1, 1+n, or no results returned from the service without chocking the "TypeError: Error #1034: Typre coercion failed:..."? This just seems wacky.