Event.ID3イベントを取得して各情報を取得します。
package {
import flash.media.Sound;
import flash.net.URLRequest;
import flash.events.Event;
public class SoundPlayWithID3 {
private var _sound:Sound;
private var _comment:String;
private var _artist:String;
private var _album:String;
private var _track:String;
private var _genre:String;
private var _year:String;
private var _songName:String;
public function SoundPlayWithID3(url:String) {
_sound = new Sound();
loadSound(url);
}
private function loadSound(url:String):void {
_sound.load(new URLRequest(url));
_sound.addEventListener(Event.COMPLETE, loadComplete);
_sound.addEventListener(Event.ID3, getID3Handler);
}
private function loadComplete(e:Event):void {
var sd:Sound = e.target as Sound;
sd.play();
}
private function getID3Handler(e:Event):void {
var sd:Sound = e.target as Sound;
_comment = sd.id3.comment;
_aritist = sd.id3.artist;
_album = sd.id3.album;
_track = sd.id3.track;
_genre = sd.id3.genre;
_year = sd.id3.year;
_songName = sd.id3.songName;
}
}
}
traceをかけると↓
Bibio
Ambivalence Avenue
1/12
Electronic
2009
Ambivalence Avenue
な感じで出力しました。
一つ注意点。ID3タグがShift-JISで書かれている場合、Flashが認識できず
ID3イベントは発生しません。必ずUTF-8に変換しないとダメらしいのです。。
僕はWindowsにSuperTagEditorをいれて編集しました。1時間ほどはまったけど。。
http://hkpr.info/flash/game/sample/s034.php
↑お世話になりました。
In this morning, I was excited by the news about honda got a goal in extra time.
I really look up to his attitude. I’m sure that he will absolutely be a key player on World Cup.