1 Reply Latest reply on Apr 17, 2010 9:21 PM by Flex harUI

    Copy XML data out of event.result to a XML var doesn't work


      So I'm pretty new to Flex, but learning with the help of a few books. I'm totally stumped here though, as I"m copying an example right out of The Flex 3 Bible and its not working the way I thin it should. My code is below. Here is my problem. I'm reading in an XML from a php script. Works fine. In Debug I can tell the event.result is getting the XML as it should. In the resultHandler I'm trying to copy it to a variable I assigned called myCollection. This is just not occuring for some reason. If I look at the variable in debug, its null. following that i"m trying to take innertags and get them out (myCollection.trumpet.settings). Of course this doesn't work because myCollection is populated with nothing. This came right out of an example on page 654... I've been bangging my head against the wall for hours. any help on how to copy this data out of event.result would be great.



      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
         import mx.rpc.events.ResultEvent;
         import mx.collections.ArrayCollection;
         private var myCollection:XML;
         private var xReturn:Object;
         private function resultHandler(event:ResultEvent):void
          myCollection = event.result as XML;
             xReturn = myCollection.trumpet.setting;
         // textbox.text = myCollection;

          <mx:HTTPService id="myService" url=""
              method="POST" showBusyCursor="true" result="resultHandler(event)"/>

          <mx:VBox left="25" top="25">
              <mx:Button label="Get Data" click="myService.send()"/>

        <mx:Label id="textbox">
      <!--       <mx:DataGrid id="myGrid" dataProvider="{myCollection}"/>-->