Flex 一个天气预报的例子

news/2024/5/18 14:20:35 标签: Flex, WebService, Adobe, BBS, XML

http://bbs.airia.cn/FLEX/thread-3987-1-1.aspx?SearchText=%E5%A4%A9%E6%B0%94%E9%A2%84%E6%8A%A5

可以直接运行

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" fontSize="12" creationComplete="ws.getWeatherbyCityName.send();initToolTip();" width="140" height="145" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#54493d, #54493d]">

<mx:Style>
Panel {
borderColor: #ffffff;
borderThicknessLeft: 1;
borderThicknessTop: 1;
borderThicknessBottom: 1;
borderThicknessRight: 1;
cornerRadius: 0;
headerHeight: 24;
backgroundAlpha: 1;
highlightAlphas: 0, 0;
headerColors: #0066ff, #0000cc;
footerColors: #00ffcc, #c7c7c7;
backgroundColor: #5C626C;
dropShadowEnabled: false;
titleStyleName: "mypanelTitle";
}

.mypanelTitle {
color: #ffffff;
fontSize: 12;
}

ToolTip {
backgroundColor: black;
cornerRadius: 0;
color: #0a84d2;
fontSize:12;
backgroundAlpha:0.4;
}
</mx:Style>
<mx:Script>
<![CDATA[

//动画ToolTipManager
import mx.managers.ToolTipManager;
private function initToolTip():void {
ToolTipManager.hideDelay = 2000;
ToolTipManager.showEffect = rotate;
ToolTipManager.hideEffect = zoom;
}
import mx.controls.Alert;
import mx.collections.ArrayCollection;
public var arrayResult:ArrayCollection;    //保存接收到的结果
public function resultOK():void{        //显示接受的结果
arrayResult=new ArrayCollection();
arrayResult=ws.getWeatherbyCityName.lastResult;

//显示今天的情况
//Today1.text=arrayResult[6].toString().substring(0,arrayResult[6].toString().indexOf(" "));
Today2.text=arrayResult[6].toString().substring((arrayResult[6].toString().indexOf(" "))+1);
TodayPanel.title = "北京:" + arrayResult[6].toString().substring(0,arrayResult[6].toString().indexOf(" "));
TodayPanel.toolTip = arrayResult[6].toString().substring(0,arrayResult[6].toString().indexOf(" ")) + arrayResult[6].toString().substring((arrayResult[6].toString().indexOf(" "))+1) + arrayResult[5] + arrayResult[7];
Today3.text=arrayResult[5];
Today4.text=arrayResult[7];
if(Today2.text=="多云"){
weatherswf1.source="icos/w3.swf"
}

if(Today2.text=="多云转小雨"){
weatherswf1.source="icos/w6.swf"
}
if(Today2.text=="晴转阴"){
weatherswf1.source="icos/w27.swf"
}
if(Today2.text=="阴"){
weatherswf1.source="icos/w4.swf"
}
if(Today2.text=="雾"){
weatherswf1.source="icos/w15.swf"
}
if(Today2.text=="多云转晴"){
weatherswf1.source="icos/w26.swf"
}
if(Today2.text=="小雨转晴"){
weatherswf1.source="icos/w26.swf"
}
if(Today2.text=="晴转多云"){
weatherswf1.source="icos/w27.swf"
}
if(Today2.text=="晴"){
weatherswf1.source="icos/w1.swf"
}
if(Today2.text=="阵雨转多云"){
weatherswf1.source="icos/w12.swf"
}
if(Today2.text=="阵雨转小雨"){
weatherswf1.source="icos/w12.swf"
}
if(Today2.text=="小雨"){
weatherswf1.source="icos/w8.swf"
}
if(Today2.text=="阵雨"){
weatherswf1.source="icos/w12.swf"
}
if(Today2.text=="大雨"){
weatherswf1.source="icos/w10.swf"
}
if(Today2.text=="雨夹雪"){
weatherswf1.source="icos/w20.swf"
}

}





]]>
</mx:Script>

<mx:Rotate id="rotate" />
<mx:Zoom id="zoom" />
<mx:WebService id="ws" wsdl="http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl"
useProxy="false" showBusyCursor="true">
<mx:operation name="getWeatherbyCityName" result="resultOK()">
<mx:request>
<theCityName>
{city.text.toString()}
</theCityName>
</mx:request>
</mx:operation>
</mx:WebService>
<mx:Panel id="TodayPanel" x="0" y="0" layout="absolute"
title="北京" toolTip="北京天气预报

"  titleIcon="@Embed('assets/tq.png')" fontSize="12" width="140" height="145" >
<mx:TextInput id="city" text="北京"  visible="false" width="20"/>



<!--显示结果的Label-->

<!--显示说明的Label-->



<mx:SWFLoader id="weatherswf1" source="icos/w1.swf" y="-0.05" x="25"/>

<mx:Label x="16.5" y="48.55" text="" width="105" id="Today2" color="#ebebeb"/>
<mx:Label x="16.5" y="72" text="" width="105" id="Today3" color="#ebebeb"/>
<mx:Label x="16.5" y="95.55" text="" width="105" id="Today4" color="#ebebeb"/>


</mx:Panel>

</mx:Application>




http://www.niftyadmin.cn/n/1313211.html

相关文章

1NF 2NF 3NF

1NF : 实体中的某个属性不能有多个值或者不能有重复的属性 2NF : 非主属性非部分依赖于主关键字 3NF : 属性不依赖于其它非主属性

所谓中华文明的传统精髓和不传之秘

宇文泰是北周开国的奠基者。当他模仿曹操&#xff0c;作北魏的丞相而“挟天子令诸侯”之时&#xff0c;遇到了可与诸葛亮和王猛齐名的苏绰。宇文泰向苏绰讨教治国之道&#xff0c;史载二人密谈三日三夜。现将二人的这次谈话直译&#xff0c;就以“所谓中华文明的传统精髓和不传…

PLSQL使用技巧

1 默认选择My Objects: Tools->Brower Filters(浏览器过滤器),选择My Object&#xff0c;并且在default前的复选框前打上勾即可。 2 执行sql&#xff1a; F8&#xff08;执行SQL Windows 中的所有的sql&#xff09;。 3 自动替换: 快捷输入SQL语句&#xff0c;例如输入s&…

SAP资源

2011Resource http://www.itpub.net/forum.php?modforumdisplay&fid45&page1 itpub ------------------------- 官方资源 ---------------------------------------- SAP WebSite www.sap.com SAP Online Document help.sap.com SAP Community NetWork ww…

Mysql之主从架构的复制原理

3.1、基于语句的复制(Statement-BasedReplication)MySQL5.0及之前的版本仅支持基于语句的复制&#xff08;也叫做逻辑复制&#xff0c;logical replication&#xff09;&#xff0c;这在数据库并不常见。master记录下改变数据的查询&#xff0c;然后&#xff0c;slave从中继日志…

MySQL主主复制技术+Keepalived

MMkeepalived 简介&#xff1a; 双主配合keepalived这种架构设计&#xff0c;也是基于主从复制的原理而搭建的。 使用MySQL主主复制技术Keepalived是一种简单、便捷的解决方案&#xff0c;在高可用集群环境中&#xff0c;keepalived使用VIP&#xff0c;使用Keepalived自带的服…

GreenDao-自定义SQL查询-拼接多个查询条件-AndroidStudio

1 //获取本地Pad&#xff08;离线工作票列表&#xff09;2 public static List<WTDetailTableBean> getPadWTList(String token,3 String userId,4 String …

医疗保险

首先&#xff0c;参保人员要在基本医疗保险定点医疗机构就医、购药&#xff0c;也可挂处方到定点零售药店外购药品。在非定点医疗机构就医和非定点药店购药发生医疗费用&#xff0c;除符合转诊等规定条件外&#xff0c;基本医疗保险基金不予支付。 其次&#xff0c;所发生医疗费…