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
& 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;
- Previous article:Why are bicycles prone to puncture in summer?
- Next article:How far is it from Xipeng Town to Meilin Community in Xiangxi, Tongjiaxi Town?
- Related articles
- Night weather
- Hazard analysis of three major types of humidifiers, six tips to solve the hazards of humidifiers
- The latest news on Zhenjiang’s third round of regional nucleic acid testing for all employees
- How high does a stewardess need?
- The origin of carnival
- What is the price of luxury yachts in Weishan Lake Scenic Area in 2022? How to make a reservation?
- What is the impact of climate change on major soybean diseases and insect pests?
- Is it cold in Norway in winter?
- When does the rainy season usually occur?
- Chongqing Hechuan Fishing City-Chihiro Cliff Ancient Battlefield