7 Replies Latest reply on Jul 23, 2008 2:52 PM by Developer504

    Noob issue: please help

    Developer504 Level 1
      I seem to take two steps forward and one step back.

      I have this app with some charts, some datagrids etc. all displaying data from external XML files via HTTPService.
      I'm trying to now just put some similar data into simple text displays, but I can't get it to work.

      Here is my very simple XML file:

      <Totals>
      <figures aTotal="3129379.74" bTotal="185599.67"/>
      </Totals>

      I want to display the value aTotal in a labels.

      So I made two variables, one XMLlist to store the data, and a string for my field value:
      [Bindable]
      private var ttDs:XMLList;
      [Bindable]
      private var aTotal:String;

      Then I read the file:
      <mx:HTTPService id="ttWs" url="totals.xml" result="handleXmlDataTT(event)" resultFormat="e4x"/>

      Drop it into an XMLList with this event function:
      private function handleXmlDataTT(event:ResultEvent):void
      {ttDs=XMLList(event.result.figures);
      aTotal=(ttDs.@aTotal);
      }

      And display:

      <mx:Label x="267" y="331" text="{aTotal}"/>

      And I get nothing on the screen, it's blank. I also tried:
      aTotal=(event.result.aTotal);

      ...but that didn't work, I also tried inserting the e4X path as the text (bypassing the aTotal variable), that didn't work either.


      Can somebody explain what I'm doing wrong here?

      M.