« Music publishing platform 001 | Main | Sample pod's player »

Flash ActionScript - RSS parser package

前回のエントリで書いた,個人やグループがWeb上で音を配信するためのプラットフォーム構想の足回りとして,FlashのAction scriptでRSSを扱うためのライブラリを作成しましたので公開します.Action scriptでネットワーク上のRSSを読み込み,Objectとしてデータを格納します(現在はRSS2.0のみ対応).ひとまず簡単なサンプルを.

Simple sample (RSS2.0のパースと結果のトレース)

RSS2.0 feed:

簡単な使い方

パッケージを利用する準備をします.解凍したパッケージフォルダ(comフォルダ以下)を,.fla ソースファイルと同じ階層か,グローバルクラス絶対パスに設置します.

グローバルクラス絶対パス

  • Windows :(Hard disk)¥Documents and Settings¥(User)¥Local Settings¥Application Data¥Macromedia¥Flash 8¥(Lang)¥Configuration¥Classes
  • Macintosh : (Hard disk)/Users/(User)/Library/Application Support/Macromedia/Flash 8/(Lang)/Configuration/Classes
http://www.example.com/index.xml を読み込んで,パース結果をトレースするサンプルです.

// import package
import com.cybozuLab.rssParser.*;

rssObj = new FetchingRss( "http://www.example.com/index.xml" );

// define the function when loading is completed
thisObj = this;
rssObj.onLoad = function( successFL,  errMsg ){
	if( successFL )
	{
		// parse RSS XML tree
		thisObj.rssParse = new ParsingRss( thisObj.rssObj.getRssXml() );
		// trace result
		trace( Utils.objToString( thisObj.rssParse.getRssData() ) );
	}
	else
	{
		trace( errMsg );
	}
}

// start loading
rssObj.load();

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)