我想要載入外部的音樂
但是發布之後有顯示載入成功卻沒有聲音
可以幫我看看是哪裡有問題嗎?
感謝!!
var PlaySound:Sound = new Sound();
var BF:SoundLoaderContext = new SoundLoaderContext(30000, true);
var SoundCH:SoundChannel =new SoundChannel();
var url:URLRequest = new URLRequest("Melody.wav");
PlaySound.addEventListener(Event.COMPLETE,SoundOK);
PlaySound.addEventListener(IOErrorEvent.IO_ERROR, ERR);
PlaySound.load(url,BF);
function SoundOK(e:Event):void
{
test_txt.text = "載入成功";
var Position:int = SoundCH.position;
SoundCH = PlaySound.play(Position);
}
function ERR(E:IOErrorEvent)
{
test_txt.text = "EEROR";
}
stop();
另外我把連結的部分換成網址
像這樣:
var url:URLRequest = new URLRequest("http://www.ehomework.com.tw/Material2/VOICE/002.mp3");
變成連載入成功都沒有顯示
增加ProgressEvent去顯示載入的進度
也沒有東西跑出來