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

Flex天气预报

发布时间:2020-12-15 04:49:14 所属栏目:百科 来源:网络整理
导读:?废话不多说,上代码: ? ? 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" ?? ??????????????? creationComplete = "ini

?废话不多说,上代码:

?

 
 
  1. <?xml?version="1.0"?encoding="utf-8"?>?
  2. <s:Application?xmlns:fx="http://ns.adobe.com/mxml/2009"??
  3. ???????????????xmlns:s="library://ns.adobe.com/flex/spark"??
  4. ???????????????creationComplete="init()"?
  5. ???????????????xmlns:mx="library://ns.adobe.com/flex/mx"?minWidth="955"?minHeight="600">?
  6. ????<fx:Script>?
  7. ????????<![CDATA[?
  8. ????????????import?mx.collections.ArrayCollection;?
  9. ????????????import?mx.controls.Alert;?
  10. ????????????import?mx.rpc.events.FaultEvent;?
  11. ????????????import?mx.rpc.events.ResultEvent;?
  12. ?????????????
  13. ????????????private?function?init():void?
  14. ????????????{?
  15. ????????????????//天气预报?
  16. ????????????????webService.getWeatherbyCityName("苏州");?
  17. ????????????}?
  18. ?????????????
  19. ????????????/***************************天气预报***************************/?
  20. ????????????private?function?onLoad(event:ResultEvent):void{????
  21. ????????????????var?weatherInfo:ArrayCollection?=?(event.result)?as?ArrayCollection;????
  22. ????????????????for(var?i:int=0;i<weatherInfo.length;i++){??
  23. ????????????????????myWeatherReport.text+=weatherInfo[i]+"?|?";????
  24. ????????????????}????
  25. ????????????}?
  26. ?????????????
  27. ????????????private?function?faultHandler(event:FaultEvent):void{????
  28. ????????????????Alert.show(event.fault.toString(),"WebService?Error");????
  29. ????????????}?
  30. ?????????????
  31. ????????]]>?
  32. ????</fx:Script>?
  33. ?????
  34. ?????
  35. ????<fx:Declarations>?
  36. ????????<!--?将非可视元素(例如服务、值对象)放在此处?-->?
  37. ?????????
  38. ????????<s:WebService?id="webService"?wsdl="http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl"????
  39. ??????????????????????useProxy="false"?showBusyCursor="true"?result="onLoad(event)"?fault="faultHandler(event)"/>?
  40. ????</fx:Declarations>?
  41. ?????
  42. ?????
  43. ????<!--天气预报-->?
  44. ????<mx:Text?styleName="weatherFont"?id="myWeatherReport"?x="450"?y="60"/>?
  45. </s:Application>

(编辑:李大同)

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

    推荐文章
      热点阅读