`

Weather Report

    博客分类:
  • Flex
阅读更多

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Panel title="Weather Report" horizontalCenter="-56" verticalCenter="-27" id="myPanel" width="600" height="450">
<mx:TextInput id="cityname" text="大连" fontSize="12"/>
<mx:Button click="webService.getWeatherbyCityName(cityname.text)" icon="@Embed('image/r_t1.gif')" />
<!--<mx:TextArea id="myWeatherReport" height="450" editable="false" fontSize="12" backgroundColor="#ffd7ff" color="#0000ff" width="600" /> -->
<mx:Panel title="Rusult" width="100%" height="320">
<mx:VBox id="vbox" fontSize="12">
</mx:VBox>
</mx:Panel>
</mx:Panel>
<mx:WebService id="webService" wsdl="http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl"
showBusyCursor="true" result="onLoad(event)" fault="faultHandler(event)" />
<mx:Style>
ToolTip {
fontFamily: "Arial";
fontSize: 14;
/*fontStyle: "italic";*/
color: #0000ff;
backgroundColor: #ffd7ff;
}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.utils.ArrayUtil;
import mx.controls.*;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.core.UIComponent;
import flash.utils.getDefinitionByName;

private function onLoad(event:ResultEvent):void{
vbox.removeAllChildren();
//Alert.show(event.result.toString(),"WebService Results");
var weatherInfo:ArrayCollection = (event.result) as ArrayCollection;
for(var i:int=0;i <weatherInfo.length;i++){
if(weatherInfo[i].toString().lastIndexOf(".gif")==1){
var imgcls:Class = getDefinitionByName("mx.controls.Image") as Class;
var imginstance:UIComponent = new imgcls();
Image(imginstance).source= "image/"+weatherInfo[i];
vbox.addChild(imginstance);
}else {
var cls:Class = getDefinitionByName("mx.controls.Label") as Class;
var instance:UIComponent = new cls();
Label(instance).text = weatherInfo[i];
Label(instance).width = 540;
ToolTip.maxWidth = 800;//设置Label.ToolTip最大宽度
if(Label(instance).text.length>500) {
Label(instance).addEventListener(ToolTipEvent.TOOL_TIP_CREATE,function (event:ToolTipEvent):void{createToolTip(event,Label(instance).text)});//调用自定义ToolTip
}
vbox.addChild(instance);
//Label(instance).truncateToFit = false;
}
//myWeatherReport.text+=weatherInfo[i]+"\n";
}
}
private function faultHandler(event:FaultEvent):void{
Alert.show(event.fault.toString(),"WebService Error");
}

import mx.events.ToolTipEvent;
//create user-defined ToolTip
private function createToolTip(e:ToolTipEvent,arg:String):void
{
var tip:MyToolTip = new MyToolTip();
tip.text=arg;
e.toolTip = tip;
}
//ToolTip position
private function positionToolTip(e:ToolTipEvent):void
{
e.toolTip.x = mouseX + 10;
e.toolTip.y = mouseY + 20;
}
]]>
</mx:Script>
</mx:Application>
====================自定义ToolTip组件"MyToolTip.mxml"=======================

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" implements="mx.core.IToolTip"
width="800" height="100%" backgroundColor="#ffd7ff" borderStyle="solid" cornerRadius="5">
<mx:Script>
<![CDATA[
[Bindable]
private var _text:String;

public function get text():String
{
return this._text;
}

public function set text(value:String):void
{
this._text = value;
}
]]>
</mx:Script>
<mx:Text text="{this._text}" color="#0000ff" fontSize="14" textAlign="left" width="798"/>
</mx:Canvas>

分享到:
评论

相关推荐

    天气预报_weather report

    用C#写的天气预报程序,正常运行。访问数据库ChinaProvinceCity.mdb

    eclipse做的weather report插件

    用eclipse做的天气预报插件,稍微有一点问题,就是当作为插件运行的时候,总是出不来,不过你可以当Java application运行,一点儿问题都没有。关键在于里面运用的技术:webservice,我用Axis2实现的。

    Weather Report Station Web Services-开源

    我确实安装了Weather Report Station设备并通过Web服务报告了天气。 Web服务是用Java语言创建的。 我在GUI程序和W​​eb Base中创建了客户端。

    Weather Report .NET

    基于Google Weather API的程序。支持中文,英文,德文。.NET3.5做的,但是,由于Google问题,不知道是否在内地可以使用?无论怎么样,可以测试下。 国外下载地址:http://www.box.net/shared/d6ct9jlpyf

    实时天气报告「Live Weather Report」-crx插件

    获取实时天气报告 直接在Chrome浏览器上获取天气信息的简便方法 “实时天气报告”是查看天气情况的漂亮,简单的扩展名。立即获取您当前位置的天气。该扩展程序带有漂亮,干净的界面 ...支持语言:English

    Live Weather Report-crx插件

    语言:English 获取实时天气报告 直接在Chrome浏览器上获取天气信息的简便方法。 “实时天气报告”是查看天气情况的漂亮,简单的扩展名。 立即获取您当前位置的天气。 该扩展程序带有漂亮,干净的界面。...

    Simple Weather Report-crx插件

    语言:English 简单的天气扩展。 允许用户获取当前天气报告:温度,风,湿度,压力,可见度等。 简单的天气延伸。 允许用户获取当前天气报告:温度,风,湿度,压力,可见度等。 用户可以设置位置和温度单位华氏度...

    Weather-Report:输入世界上任何城市的名称,它将告诉您当前该城市的温度和天气

    天气预报 输入世界上任何城市的名称,它将告诉您当前该城市的温度和天气。

    天气预报小工具

    Weather Report Online是一款在线实时查询和预报各地天气的小 软件。天气预报服务数据来源于中国气象局http://www.cma .gov.cn/。数据每2.5小时左右自动更新一次,准确可靠。包括 340 多个中国主要城市和 60 多...

    Active Man in the Middle Atacks

    an attacker can steal users' private data for any site he chooses if his victim uses a public network to read the latest news headlines or weather report on an 'uninteresting' site. In addition, the ...

    Metar Weather Report System &#40;MWRS&#41;-开源

    梅塔尔天气报告系统(MWRS)是一种安全驾驶的工具,它可以解码给定位置的天气梅塔尔,以及是否有必要的危险警报(冰冷的道路,大雪等),并提供天气预报,以预测天气如何几个小时

    Mars-Weather-Report:一个 Android 应用程序,显示美国宇航局好奇号火星车在火星上收集的最新天气数据

    火星天气报告 一款 Android 应用程序,可显示 NASA 好奇号火星探测器收集的最新天气数据。 连接到 [MAAS API] ( ) 并从 NASA 获取最新的可用天气数据。 所有网络都是使用 Square 出色的库完成的。...

    weatherreportmain

    weather report main ui

    PyPI 官网下载 | cloud-weather-report-0.3.6.tar.gz

    资源来自pypi官网。 资源全名:cloud-weather-report-0.3.6.tar.gz

    vc.net weather_report

    通过vc.net下实现天气预报,有数据库,文档说明,其他之类的。。

    powercord-weather:一个用于检查天气的powercord插件

    设定值单位: SI (除美国以外的所有国家/地区都使用过) USCS (在美国使用) 以m / s显示风速的选项展示: 展示ASCII艺术Weather report: Warsaw, Poland _`/"".-. Light rain shower, rain with thunderstorm ,\_...

    ChatGPT4 插件汇总和插件评测,以及插件使用案例!详细教程!共计43个插件汇总!

    ChatGPT4 插件汇总和插件评测,以及插件使用案例!详细教程!共计43个插件汇总! 推荐插件一览 Wolframe WebPilot FiscalNote Speak Prompt Perfect Diagram It AskYourPDF ...Weather Report Data

    Weather-Report

    Weather-Report

    fasypay-webservice-client:小的

    b) GetWeather :Get weather report for all major cities around the world. 我们已经写了一个junit来测试上述操作 GlobalWeatherTest:使用此junit测试用例测试上述操作。 a) testGetCitiesByCountry b)

    poc:GB Dev POC工作

    b) GetWeather :Get weather report for all major cities around the world. 我们已经写了一个junit来测试上述操作 GlobalWeatherTest:使用此junit测试用例测试上述操作。 a) testGetCitiesByCountry b) te

Global site tag (gtag.js) - Google Analytics