我可以播放音樂與SoundManager類2,當我按下按鈕但是加載下一個聲音,當我嘗試通過onfinish
功能它沒有做到這一點的功能工作的功能工作中當音樂播放完成它不會加載下一個聲音,這意味着我怎麼能得到這個工作,請參見下面的代碼。聲音在Soundmanger2
function playSong(id) {
//Stop the sound from playing
soundManager.destroySound(mySound);
//If we're under, just go to the end!
if (id < 0)
id = songs.length - 1;
//If we're over, choose what to do via the repeat flag
if (id >= songs.length)
id = 0;
//Save some variables
playingSongId = id;
playingSong = songs[playingSongId];
track = playingSong.artist_name + " " + "-" + " " + playingSong.track_name;
//Create the sound and begin playing whenever!
soundManager.createSound({
id: mySound,
url: playingSong.track_url,
multiShotEvents: true,
autoPlay: true,
stream: true,
onplay: function() {
setPlayingInfo(track);
setPauseState(false);
setPlayTime();
},
onfinish: function() {
playNextSong();
/*//We'll only continue if we're shuffling or repeating if we past the end...
if (shuffle == false && (playingSongId + 1 >= songs.length) && repeat == false) {
//No more songs...
setPlayingInfo();
setPauseState(false);
setPlayTime();
playingSong = null;
playingSongId = null;
return;
}
else {
playNextSong();
}*/
},
該函數作爲下一個聲音的標題出現在標題中,但歌曲從不播放。最後,當我點擊的同時加載聲音的第一聲音鏈接和播放標題,如果我點擊按鈕加載下一個聲音出現在標題不加載不過。請注意,我通過ajax加載這些聲音,因爲聲音位於遠程服務器上。
正是我應該把'oundManager.setup({flashVersion:9})'應該從創建功能分開? – 2013-04-08 15:18:29