1 Reply Latest reply on Jun 29, 2012 1:09 PM by WebolutionDesigns

    Binding web service results (XML) to components


      I am new to Flex/Flash Builder (have been CFer for years). I am trying to learn the tool/syntax, etc. to utilize Flash Builder to build a Flex application for AIR. So here is my newbie question...


      I have a simple webservice that I wrote in a CFC. It appears to be working correctly as I can hit it and display the lastresult as a string with no problem. The result that comes back is an XML result. What I would like to do is to access specific pieces of the XML to render in a component, say a label.


      Here is my XML result...




           <user id="123">

                <name>Company Buyer</name>






      Here is my FB code...


      <?xml version="1.0" encoding="utf-8"?>

      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"






                  import mx.collections.ArrayCollection;

                  import mx.controls.Alert;

                  import mx.rpc.events.FaultEvent;

                  import mx.rpc.events.ResultEvent;


                  // Variable decalrations --------------------------------------



                  private var userInfo:ArrayCollection;



                  protected function button_clickHandler(event:MouseEvent):void


                      loginUserResult.token = users.loginUser(argUsernameTextInput.text,argPasswordTextInput.text);




                  protected function users_resultHandler(event:ResultEvent):void


                      userInfo = event.result as ArrayCollection;




                  protected function users_faultHandler(event:FaultEvent):void


                      Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail);






          <!-- Declarations -->



              <s:CallResponder id="loginUserResult"/>

              <users:Users id="users"





              <!-- Place non-visual elements (e.g., services, value objects) here -->




          <!-- UI Components -->


          <mx:Form defaultButton="{button}" id="loginForm" dropShadowVisible="false">

              <mx:FormItem label="User Name">

                  <s:TextInput id="argUsernameTextInput"/>


              <mx:FormItem label="Password">

                  <s:TextInput id="argPasswordTextInput"/>


              <s:Button label="LoginUser" id="button" click="button_clickHandler(event)"/>


          <mx:Form x="0" y="149">

              <mx:FormItem label="LoginUser">


              <s:TextArea id="loginUserTextInput" text="{loginUserResult.lastResult as String}" height="191" width="428"/>





      I searched the web to try to find a simple tutorial and could not find anything. So I am probably missing something simple. Any thoughts?