'rss'相關日誌共 1 篇

  1. 2007/02/06 用Flex試著抓RSS來讀

用Flex試著抓RSS來讀

Flex 2007/02/06 10:05
在flex中找了一個範例來練習一下~
程式碼裡頭標顏色的字是和資料連結有關的部份,其他都是屬性的設定

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="feedRequest.send()">
<mx:HTTPService id="feedRequest" url="http://weblogs.macromedia.com/mchotin/index.xml" useProxy="false" />
<mx:Panel x="25" y="10" width="679" height="482" layout="absolute" id="BR" label="{feedRequest.lastResult.rss.channel.title}">
<mx:TextArea x="33" y="216" width="550" height="184" htmlText="{dgPosts.selectedItem.description}"/>   //dgPosts.selectedItem=feedRequest.lastResult.rss.channel.item
<mx:DataGrid x="33" id="dgPosts" width="550" dataProvider="{feedRequest.lastResult.rss.channel.item}" y="41">              //item重複DataGrid 會知道裡面的資料記錄自己會重複...很無言的功能
  <mx:columns>
   <mx:DataGridColumn headerText="Posts" dataField="title"/>   //item裡頭的標籤有一個叫title的標籤拿來當資料
   <mx:DataGridColumn headerText="Date" dataField="pubDate" width="150"/>   //item裡頭的標籤有一個叫pubDate</mx:columns>
</mx:DataGrid>
<mx:LinkButton x="33" y="411" width="200" label="link to {dgPosts.selectedItem.title}" click="navigateToURL(new URLRequest(dgPosts.selectedItem.link));" />
</mx:Panel>
</mx:Application>

這裡有個疑問,就是用{}包起來和不包起來有什麼差????好像可以做變數與字串的連結....像這樣"link to {dgPosts.selectedItem.title}"

用起來真的粉方便ㄟ!!
top
TAG ,

Trackback Address :: http://diary.tw/allenliao/trackback/22

Write a comment