ritetek
asked on
Loading multiple songs with loadSound
I have a site that loads a song everytime a different page is loaded as follows,
var song:Sound = new Sound();
song.onLoad = function(success:Boolean): Void {
if (success) {
trace("Song Loaded");
}
};
song.loadSound( "music/song1.mp3" , true);
I want to know if there is anyway to load a different song after the first one is finished playing, such as playing song1 until it finishes then playing song2.
var song:Sound = new Sound();
song.onLoad = function(success:Boolean):
if (success) {
trace("Song Loaded");
}
};
song.loadSound( "music/song1.mp3" , true);
I want to know if there is anyway to load a different song after the first one is finished playing, such as playing song1 until it finishes then playing song2.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks ivan, i'm sorry i couldn't give you points, but i will definitley use your method if i need to use a lot of songs.
No problem :o)
ivan_os
ivan_os
var songList = new Array("music/song1.mp3","m
var songPlaying = 0;
var song:Sound = new Sound();
song.onSoundComplete = function ()
{
songPlaying++;
if(songPlaying == songList.length ) songPlaying = 0;
_root.song.loadSound( songList[songPlaying] , true);
}
song.loadSound( songList[songPlaying] , true);
Regards,
ivan_os