1 Reply Latest reply on Oct 28, 2008 8:32 PM by atta707

    receive XML

    phil1943 Level 1
      Hello, I have created this PHP code below which returns an object ($Return), formatted in XML to a Flex HTTPService call.
      I am not sure how to code my HTTPService resulthandler function to receive it correctly as an ArrayCollection.
      Can someone please help with a brief code example of how my Flex resulthander function should look ?
      Thanks kindly.

      $Return = "<root>";
      while ( $imageObject = mysql_fetch_object( $result ) ) {
      $Return .= "<image>".$imageObject->PHOTONAME."</image>";
      $Return .= "</root>";
      print ($Return)
        • 1. Re: receive XML
          atta707 Level 2
          In your Flex Builder help please search for "Using HTTPService components" and an intro.

          Essentially, you'll be listening for result event and get the data from the event object object like:

          <mx:HTTPService id="userRequest" url=" http://server:8500/flexapp/returncfxml.cfm" useProxy="false" method="POST" resultFormat="e4x"

          Now in your result event, you'll do something like:

          XMLListCollection list = userService.lastResult.image;

          assuming your </root> has many <image> tags in it.

          That should work. You should many many examples if you google the subject.