Groups | Blog | Home
all groups > flash actionscript > april 2004 >

flash actionscript : Can I play background music one after another?


Biologicalboy
4/10/2004 5:17:54 PM
I used "loadSound()" command to load five MP3 files dynamically.But my goal is
let the five bg music play one after another.this is to say,when the first bg
music is finished,it can play the sceond automatically,and then the third?
Can this possible?and how?Thanks!!
Jack.
4/10/2004 5:46:55 PM
pop the mp3 names from a temporary array,
use onSoundComplete to run the loop,

PATH = "mymp3/";
MP3Array = ["songa","songb","songc","songd","songe"];
temp2 = [];
loadTemp2();

function loadTemp2(){
if(temp2.length==0){
for(var n=0; n!= MP3Array.length; n++){
temp2[n] = MP3Array[n];}
temp2.reverse();
}
playTemp2();
};

function playTemp2(){
toplay = temp2.pop();
track.text = toplay;
myMP3 = new Sound(this);
myMP3.loadSound(PATH+toplay+".mp3",true);
myMP3.onSoundComplete=function(){loadTemp2();};
};

hth
AddThis Social Bookmark Button