title: How to return HTTP Service response in flex?
body: <p>I am clear about how to use HTTP Service in flex but i want to separate the functionality of calling service and getting response of the service in a different ActionScript class. So does anyone know how can i return the response of the HTTP service in flex ?</p>
  
  <p>for e.g. </p>
  
  <p>IN UTILITY class i want to have one method to which i will give one URL and it will give me the data obtained from that location. That's it. consider the following code snippet. reference code taken from <a href="https://stackoverflow.com/questions/12586484/could-not-be-able-to-create-http-service-programmitically-in-flex">could not be able to create http service programmitically in flex</a></p>
  
  <pre><code>        private function callService():void
          {
              var requestObj:Object = {};
              requestObj.q = cityName.text.toString();
              requestObj.format = FORMAT;
              requestObj.num_of_days = cNUMBER_OF_DAYS;
              requestObj.key = API_KEY;
  
              var weatherService:HTTPService = new HTTPService();
              weatherService.url = BASE_URL;
              weatherService.resultFormat = "object";
              weatherService.showBusyCursor = true;
              weatherService.request = requestObj;
              weatherService.addEventListener(ResultEvent.RESULT , weatherService_resultHandler);
              weatherService.addEventListener(FaultEvent.FAULT, weatherService_faultHandler);
              weatherService.send();
          }
  
          protected function weatherService_resultHandler(event:ResultEvent):void
          {
              trace("got result");
              **//WANT TO GIVE THIS RESULT BACK TO THE CALLER. SINCE RETURN TYPE OF 
              //METHOD IS VOID I CANNOT RETURN ANYTHING FROM HERE. HOW TO MAKE THIS
              //METHOD TO RETURN DATA?**
          }
  
          protected function weatherService_faultHandler(event:FaultEvent):void
          {
              trace("got fault");
          }
  </code></pre>