Traditional Culture Encyclopedia - Weather inquiry - How to call the web service of weather forecast with flex

How to call the web service of weather forecast with flex

& lt? Xml version =" 1.0 "encoding ="utf-8"? & gt

& ltMX:windowed application xmlns:MX = "/web services/weather web service . asmx? wsdl " showBusyCursor = " true " result = " onLoad(event)" fault = " fault handler(event)"/& gt;

& ltMX:Script & gt;

& lt! [CDATA[

Import mx.controls.alert;

Import mx.rpc.events.faultevent;

Import mx.collections.arraycollection;

Import mx.rpc.events.resultevent;

Private function onLoad(e:ResultEvent):void{

var weather info:array collection =(e . result)as array collection;

for(var I:int = 0; I & weatherinfo.lengthi++) {

city weather . text+= weather info[I]+" \ n ";

}

}

Private function faultHandler (e: faultevent): void {

Alert.show(e.fault.toString(),“web service Error”);

}

Private function findeater (): void {

cityWeather.text =

weather web service . getweatherbycityname(city name . text);

}

]]& gt;

& lt/MX:Script & gt;

& ltMX:TextInput x = " 10 " y = " 53 " id = " city name "/& gt;

& ltMX:buttonx = " 178 " y = " 53 " label = " query " click = " findWeather()"/& gt;

& ltMX:TextArea x = " 10 " y = " 96 " width = " 665 " height = " 362 " id = " city weather "/& gt;

& lt/MX:windowed application & gt;