你可以嘗試捕獲錯誤在id3Handler,萬一ID3標籤中沒有定義
function id3Handler(evt:Event):void {
try{
songInfo.text = /*song.id3.artist + ": " +*/ song.id3.songName;
}catch(e:Error)
{
trace(e);
//or...
songInfo.text = "No name"
}
}
雖然,你可能有一個安全問題,ID3信息,將在這樣的情況下返回。你使用跨域策略文件嗎?從Sound類文檔
提取物:
Certain operations dealing with sound are restricted.
The data in a loaded sound cannot be accessed by a file in a different domain
unless you implement a cross-domain policy file.
Sound-related APIs that fall under this restriction are
Sound.id3 ,
SoundMixer.computeSpectrum(),
SoundMixer.bufferTime,
and the SoundTransform class.
編輯:
這裏是一個非常寬容的政策文件,複製它,將它保存到一個文件,並將文件命名
crossdomain.xml
然後將其上傳到您網站的根文件夾,例如example.com
http://example.com/crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy> <site-control permitted-cross-domain-policies="all"/>
<allow- access-from domain="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
</cross-domain-policy>
如果一切正常,請閱讀這篇文章
http://kb2.adobe.com/cps/142/tn_14213.html
,看你怎麼可以用我,用我網站上的MP3播放器開發的跨域策略文件
查看它,對不起,第二段應該說「我今天搞亂了*文件」和「難道這就是爲什麼* MP3播放器不加載「 – mike 2010-09-15 06:15:01
我記得通過將MP3放在與檢索它相同的文件中來解決這個問題。有點奇怪,但使用像file/location.mp3文件結構wouldnt工作,它必須在同一個文件 – mike 2012-09-04 12:01:45