Sound over a bunch of scenes

does anybody have problems with this?

i have a bunch of scenes in a web cartoon i’m doing and i want a constant song to go over them all without breaking, is there someway of doing this? do i have to throw every scene all into one scene? is that the only way

:alien:
By no means. While most people seem scared of scenes (they are wierd and add extra filesize…but I like them), you merely have to do something like this:


//makes the object "backgroundSong" a sound object
_root.backgroundSong = new Sound();
//attaches an mp3 in from the library with the
//linkage name of "backing" to the sound object
//"backgroundSong"
_root.backgroundSong.attachSound("backing");
//tell the sound object "backgroundSong" to start
//playing the attached mp3 at second 0 of the song
//and play the song only 1 time
_root.backgroundSong.start(0,1);
//this set of code will be executed when the song
//completes playing 
_root.backgroundSong.onSoundComplete = function() {
//When the song completes playing...
//start the song at second 0 and play
//only 1 time
_root.backgroundSong.start(0,1);
}

Alright, the comments should explain the code. Now, if you’ve encountered something of this sort before, you might be wondering why I didn’t write code like this…


//loop the song 99 times
_root.backgroundSong.start(0,99);

Well, say someone sits there and listens to the song a 99 times…well…then there’s no music. So, the code I’ve written will continue to play the song because, when the song is finished playing, it starts it over. It’s like a continuous loop. Of course, this can be stopped by telling the sound object to stop (in which case the onSoundComplete code is not executed):


//STOP! I'm tired of the song...
_root.backgroundSong.stop();

Alright, that should be it.

Later,
–Elios

you the man elios

thanks