5 Replies Latest reply on Jun 1, 2010 2:54 PM by GordonSmith

    Wait for the result from HttpService

    Atanasoski

       

       

       

      -I have made a validation for url string to check if it’s a valid rss feed. Validation is dependent from the HTTPService result, so it needs to wait for the result received from the HTTPService in order to validate the url.

      Here are few rows from the code:

       

      override protected function doValidation(value:Object):Array

      {

      if (!isRssFeed(value.toString()))

      {

      results.push(new ValidationResult(true, "", "rssFeed", rssFeedError));

      }

      }

       

      private function isRssFeed(s:String):void

      {          

                        httpServ.url = s;

                        httpServ.addEventListener(ResultEvent.RESULT, HttpServResultHandler);

                        httpServ.addEventListener(FaultEvent.FAULT, HttpServFaultHandler);                 

                        httpServ.send();

      }