加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

简易天气预报

发布时间:2020-12-17 01:17:00 所属栏目:安全 来源:网络整理
导读:?xml version="1.0" encoding="utf-8"? s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" ????? xmlns:s="library://ns.adobe.com/flex/spark" ????? xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="200" minHeight="200" ?fx:Declarations ?

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
????? xmlns:s="library://ns.adobe.com/flex/spark"
????? xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="200" minHeight="200">
?<fx:Declarations>
??<mx:WebService id="webService" wsdl="http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl"
??????? showBusyCursor="true" result="onLoad(event)" fault="faultHandler(event)"/>
?</fx:Declarations>
?<fx:Script>
??<![CDATA[
???import mx.collections.ArrayCollection;
???import mx.controls.Alert;
???import mx.rpc.events.FaultEvent;
???import mx.rpc.events.ResultEvent;
???import mx.utils.ArrayUtil;
???private function onLoad(event:ResultEvent):void{
????//Alert.show(event.result.toString(),"WebService Results");
????var weatherInfo:ArrayCollection = (event.result) as ArrayCollection;
????for(var i:int=0;i <weatherInfo.length;i++){
?????myWeatherReport.text+=weatherInfo[i]+"/n";
????}
???}
???private function faultHandler(event:FaultEvent):void{
????Alert.show(event.fault.toString(),"WebService Error");
???}


???protected function button1_clickHandler(event:MouseEvent):void
???{
????webService.getWeatherbyCityName(cityname.text);
???}

??]]>?</fx:Script>??<s:Panel width="224" height="276">??<s:TextInput id="cityname" text="北京"? x="10" y="213"></s:TextInput>??<s:Button label="查询" x="142" y="213" click="button1_clickHandler(event)"></s:Button> ??<s:TextArea id="myWeatherReport" height="196" width="201" editable="false"? x="11" y="9"></s:TextArea>?</s:Panel>?</s:Application>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读