1 Reply Latest reply on Oct 17, 2006 11:44 AM by aBill

    HTTPService Login system

      Hi I was just wondering if any one could help me out with this, i am trying to create a user login sytem using the HTTPService that passes username & email to the server and returns the users details, from which i can then log them into the flex system. I have managed to set up the sending of the data and returning of the user data into a data grid, however when i try to extract just one element from the returned XML data i cant seem to move down the nodes my xml is returned in this format ::

      Im trying to pass the userlevel data into a actionScript variable is there anyway to do this?

      And here is my MXML file::
      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml" width="160"
      horizontalAlign="center" cornerRadius="10" borderStyle="solid" borderThickness="1"
      backgroundColor="#c0c0c0" dropShadowEnabled="true" >
      import mx.controls.Alert;
      import mx.rpc.events.ResultEvent;
      import mx.collections.ArrayCollection;
      private var loginData:ArrayCollection;

      private function loginDataHandler(event:ResultEvent):void{
      loginData = event.result.rss.channel.item;
      <mx:HTTPService id="loginRequest" url="PHP/Login.php" method="POST"
      <mx:Label text="LOGIN"/>
      <mx:TextInput id="userName_txt" width="140" text="UserName"/>
      <mx:TextInput width="140" id="password_txt" text="Password" displayAsPassword="true"/>
      <mx:Button label="Login" id="login_btn" click="loginRequest.send()"/>
      <mx:DataGrid id="loginAuth" dataProvider="{loginRequest.lastResult.rss.channel.item}
      " width="150" height="71">
      If anyone can tell me how to pass variables from the returned XML into actionsript that would be great as i can probably work it out from there.
      Absolutely any help or ideas would be great.
      Thanks in advance
        • 1. HTTPService Login system

          By default the HttpService deserialize return xml as object. Setting datagrid.dataprovider to an object won't work. It takes array or arrayCollection.

          loginRequest.lastResult.rss.channel.item is an object

          if you want to show it on datagrid, you can do this
          instead of

          William Chan

          From AS doc
          resultFormat property

          resultFormat:String [read-write]
          Value that indicates how you want to deserialize the result returned by the HTTP call. The value for this is based on the following:

          Whether you are returning XML or name/value pairs.
          How you want to access the results; you can access results as an object, text, or XML.
          The default value is object. The following values are permitted:
          object The value returned is XML and is parsed as a tree of ActionScript objects. This is the default