Mega Code Archive

 
Categories / Flex / Data Model
 

A load event for WebService

<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">     <mx:WebService id="WeatherService"                     wsdl="/WeatherService?wsdl"                     result="successfulCall();"                     fault="errorCall();">         <mx:operation name="GetWeather">             <mx:request>                 <ZipCode>{zipCode.text}</ZipCode>             </mx:request>         </mx:operation>     </mx:WebService>     <mx:Script>                  import mx.controls.Alert;         private function processValues():void {             WeatherService.GetWeather.send();         }         private function successfulCall():void {             vs1.selectedIndex=1;         }         private function errorCall():void {             Alert.show("Web service failed!", "Alert Box", Alert.OK);         }            </mx:Script>     <mx:ViewStack id="vs1">         <mx:Form>             <mx:FormItem label="Zip Code">                 <mx:TextInput id="zipCode" width="200" text="Zip code please?" />                 <mx:Button width="60" label="Submit" click="processValues();" />             </mx:FormItem>         </mx:Form>         <mx:VBox>             <mx:TextArea text="{WeatherService.GetWeather.lastResult.CityShortName}" />             <mx:TextArea text="{WeatherService.GetWeather.lastResult.CurrentTemp}" />         </mx:VBox>     </mx:ViewStack> </mx:Application>