<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="feedRequest.send(),createListener()">
<mx:HTTPService id="feedRequest" url="http://blog.csdn.net/zhuzhao/Rss.aspx" useProxy="false">
</mx:HTTPService>
<mx:Panel x="10" y="10" width="551" height="364" layout="absolute" title="{feedRequest.lastResult.rss.channel.title}">
<mx:DataGrid x="10" y="10" width="511" height="165" dataProvider="{feedRequest.lastResult.rss.channel.item}" id="dg">
<mx:columns>
<mx:DataGridColumn headerText="標題" dataField="title"/>
<mx:DataGridColumn headerText="描述" dataField="description"/>
<mx:DataGridColumn headerText="銜接" dataField="link"/>
<mx:DataGridColumn headerText="發表時間" dataField="pubDate"/>
</mx:columns>
</mx:DataGrid>
<mx:TextArea x="10" y="183" height="37" width="511" htmlText="{dg.selectedItem.description}"/>
<mx:LinkButton x="10" y="228" label="read full post" click="navigateToURL(new URLRequest(dg.selectedItem.link));"/>
<mx:Label x="19" y="258" text="Label"/>
<mx:Label x="70" y="286" text="Label" id="lable"/>
<mx:TextInput x="70" y="256" id="txt"/>
<mx:Button x="238" y="256" label="Button" id="btn"/>
</mx:Panel>
<mx:Script>
<![CDATA[
public function createListener():void {
btn.addEventListener(MouseEvent.CLICK, my);
}
public function my(e:Event):void
{
var rate:Number=120;
var price:Number=Number(txt.text);
if (isNaN(price)) {
lable.text = "Please enter a valid price.";
} else {
price = price * rate;
lable.text = "Price in Yen: " + String(price);
}
}
]]>
</mx:Script>
<mx:ComboBox x="33" y="392">
<mx:dataProvider>
<mx:Array>
<mx:String>a</mx:String>
<mx:String>b</mx:String>
<mx:String>c</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
</mx:WindowedApplication>
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhuzhao/archive/2008/06/06/2517500.aspx
|