Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <s:HTTPService id="weatherService"
- url="{BASE_URL}"
- resultFormat="object"
- result="weatherService_resultHandler(event)"
- fault="weatherService_faultHandler(event)"
- showBusyCursor="true">
- <s:request xmlns="">
- <q>{cityName.text.toString()}</q>
- <format>{FORMAT}</format>
- <num_of_days>{NUMBER_OF_DAYS}</num_of_days>
- <key>{API_KEY}</key>
- </s:request>
- </s:HTTPService>
- import mx.rpc.http.HTTPService;
- 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");
- }
- protected function weatherService_faultHandler(event:FaultEvent):void
- {
- trace("got fault");
- }
Add Comment
Please, Sign In to add comment