而建立html主要是復製一個template.html,並將內容做修改
//Build.XML//先把index.template.html檔案復製到專案資料夾裡的bin裡,重新命名為index.html //index.template.html //這檔案裡在title裡加入${title}是給ANT替換用//將index.html檔案裡的${title}替換
FDT_ANT_progression4Demo.zip |
//Build.XML//先把index.template.html檔案復製到專案資料夾裡的bin裡,重新命名為index.html //index.template.html //這檔案裡在title裡加入${title}是給ANT替換用//將index.html檔案裡的${title}替換
FDT_ANT_progression4Demo.zip |
progression4templates.zip |
我們常在全flash網頁上看到的最新消息都只是另開一個新的視窗,連結到blog,而不把內容做在flash裡,要用AS寫出這樣的功能是沒問題的,但單單只是要做到這樣功能,會需要用到資料庫來存取資訊,在維護上如果要做到簡便,會需要多寫個後台來管理,所需的人力時間成本相當的高,如果是採用把最新消息導到blog,直接使用blog的功能,可以達到方便更新又省時省人力,只需多出一個blog版型
Blog都會提供RSS資料,可以透過xmlsyndication.swc方便取得所要資訊。
以下是主要程式碼:
import com.adobe.xml.syndication.rss.Item20; import com.adobe.xml.syndication.rss.RSS20; import flash.display.MovieClip; import flash.events.Event; import flash.net.URLLoader; import flash.net.URLRequest; /** * @author georgelynch */ public class RSSDemo extends MovieClip { //- PRIVATE & PROTECTED VARIABLES ------------------------------- private var _RSSFeedURL : String = "http://georgeeeeeeeeee.blogspot.com/feeds/posts/default?alt=rss"; private var _RSS2 : RSS20; private var _ldr : URLLoader; //- PUBLIC & INTERNAL VARIABLES -------------------------------- //- CONSTRUCTOR ------------------------------------------------ public function RSSDemo() { _ldr = new URLLoader(); _ldr.addEventListener(Event.COMPLETE, loadCompleteHandler); _ldr.load(new URLRequest(_RSSFeedURL)); } private function loadCompleteHandler(event : Event) : void { _RSS2 = new RSS20(); _RSS2.parse(URLLoader(event.target).data); var items : Array = _RSS2.items; for each(var item:Item20 in items) { trace('item.title: ' + (item.title)); trace('item.link: ' + (item.link)); } } }
範例下載:RSSDemo.rar
下載SWC:xmlsyndication.swc
../src .;../src;../classes;../libs