I saw many flash web sites that has multiple music tracks to choose. I would like to learn this nice feature. Is there a tutor? how i can add multiple soundtracks for my flash presentation, I know how to add one soundtrack into my flash movie but i don’t know how add several music tracks and how to make button to load one and unload the other.
one way to do it is make an array that holds all your song files, and then access the array to get the next song name
this method is loading sound files from your hd directory–make sure the sound files are in the same directory as your .swf file–you can name your sound files whatever you want, but make sure to match their names in your array
//put this on the root level, frame 1
songArray=[“song1.mp3”, “song2.mp3”, “song3.mp3”];
aLen=songArray.length;
function loadSong(){
currentSong+=1;
mySound= new Sound(this);
mySound.loadSound(songArray[currentSong]);
mySound.start();
}
currentSong=0;
mySound= new Sound(this);
mySound.loadSound(songArray[currentSong]);
mySound.start();
//put this on your button:
on(release){
_root.loadSong();
this calls the function loadSong, which increments currentSong, which you then use to select the next member of the array, create a new mySound object, and then load it w. the next member of your song array…
there may be some little glitches in the code, as i’m writing it away from flash, so just let me know if you’re having any probs…
-mojo
Creating engaging and entertaining content for designers and developers since 1998.