3 Replies Latest reply on Sep 1, 2007 6:35 AM by Anti-Girl

    store HTTPService result in XMLLIST?

      Hey i want to store the result of my HTTPService request in an XMLList.
      ive tried using result inside the HTTPService tag .. and seperate but no avail

      if the returned result embedded between <record> </record>
      then is this correct

      var searchResult:XMLList = XMLList(connection.lastResult.record);

      do i use lastResult ? when i print it in a List, i get nothing .

      <mx:HTTPService id="connection" url=" http://www.irishineurope.ie/cgi-bin/NLI/france-county.pl?search=reg" method="GET" useProxy="false">
      <mx:request xmlns="">

        • 1. Re: store HTTPService result in XMLLIST?
          Navin Reddy
          i think..if returned result is assained as dataProvider of any mx controls application will wait for Http srevice's last result.but here you are assigning the returned result to action script variable, i think action scrip variable wont wait for the http service's esult....we can acces the retuned result after request is completed.....i used the fallowin code in my project

          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" initialize="intializeService();" creationComplete="startService();" xmlns:net="flash.net.*">

          [Bindable] public var urlLoader:URLLoader;
          [Bindable] public var urlReq:URLRequest;
          var lastResult:XMLList = new XMLList();

          public function intializeService():void
          urlLoader= new URLLoader();
          var urlAdress :String = ' http://www.................." // url address

          urlReq = new URLRequest(urlAdress);


          public function startService():void


          private function configureUrlLoaderListeners(dispatcher:IEventDispatcher):void
          dispatcher.addEventListener(Event.COMPLETE, urlLoadCompleted);
          //dispatcher.addEventListener(Event.OPEN, openHandler);
          //dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
          // dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
          //dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
          //dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
          private function urlLoadCompleted(event:Event):void
          // here you can access the data

          var loadedXml:XML = XML(urlLoader.data);
          • 2. Re: store HTTPService result in XMLLIST?
            Anti-Girl Level 1
            Thanks Navin but i would rather not use URLLoader at all , aswell HTTPService worked fine when storing result in an AS3 variable, this is when i was reading in straight from the XML file, rather than a CGI script?


            public function dataHandler(evt:ResultEvent):void
            dataDetails = XML(evt.result);

            <mx:HTTPService id="e4xService" url="data/tester.xml" result="dataHandler(event)" resultFormat="e4x"/>

            • 3. Re: store HTTPService result in XMLLIST?
              Anti-Girl Level 1
              i got it it was a simple mistake i was under the impression that connection.send will need to be initiated everytime a different request is made, but as far as i know and have experienced once a connection is made you can requests different queries, so creationComplete="connection.send()"

              and i used the above code, declared search result as an XML List and
              searchResult = XMLList(dataDetails);

              thats what i get for working so late at night :)
              thanks Navin