yahoo!pipesで天気テスト HaraMakoto forked:3favorite:6lines:66license : MIT License modified : 2009-08-08 10:47:07 Embed Tweet package { import flash.display.Sprite; import flash.events.Event; import flash.net.URLLoader; import flash.net.URLRequest; import flash.text.TextField; [SWF(width = "465", height = "465", frameRate = "30", backgroundColor="0x000000")] public class weathertest extends Sprite { private var txtField:TextField = new TextField(); private var urlLoader:URLLoader = new URLLoader; private var wXML:XML; //最高、最低、天気 private var max:String; private var min:String; private var wed:String; public function weathertest() { addChild(txtField); txtField.width=300; txtField.height=500; txtField.textColor = 0xFFFFFF; txtField.x = txtField.y = 50; ldLoad(); } private function ldLoad():void { urlLoader.load(new URLRequest("http://pipes.yahooapis.com/pipes/pipe.run?_id=c2e1d75103bdbf5799d5fbd3cf1f7bb6&_render=rss")); urlLoader.addEventListener(Event.COMPLETE, compHandler); } private function compHandler(e:Event):void { wXML = new XML(urlLoader.data); var todayString:String = wXML.channel.item[1].description; //max = todayString.split("最高気温は")[1]; //max = max.split("℃")[0]; //var min:String = todayString.split("最低気温は")[1]; //min = min.split("℃")[0]; if( !todayString.split("最高気温は")[1] ) { max = "--" } else { max = todayString.split("最高気温は")[1]; max = max.split("℃")[0]; } if(!todayString.split("最低気温は")[1]) { min = "--"; } else { min = todayString.split("最低気温は")[1]; min = min.split("℃")[0]; } var todayWed:String = todayString.split("天気は")[1]; switch(todayWed.substr(0,1)) { case("晴"): wed="shine"; break; case("雨"): wed="rain"; break; case("曇"): wed = "cloud" break; } var s:String=""; s += "今日の東京は\n"; s += "最高気温"+max+"度\n"; s+= "最低気温"+min+"度\n"; s+="天気は"+todayWed.substr(0,1); txtField.text = s; } } } Code Fullscreen Preview Fullscreen DOS day_of_the_v.. huixie paq umhr : yahoo!pipes phillosophic.. : apiyahoo!pipes _level0.KAYAC api yahoo!pipes substr XML height width textColor Math.min Math.max URLRequest TextField String text addChild Sprite sort new page view favorite forked pv208 forked from: yahoo!pipesで天気テスト.. toilet11 forked:0 favorite:0lines:66 (diff:2) pv189 forked from: yahoo!pipesで天気テスト.. meat18 forked:0 favorite:0lines:66 (diff:1) pv361 forked from: yahoo!pipesで天気テスト.. ayuzak forked:1 favorite:0lines:58 (diff:1)