Groups | Blog | Home
all groups > flash actionscript > november 2005 >

flash actionscript : How to play music uninterrupted between scenes?


Poets And Madmen
11/25/2005 1:01:56 PM
I am working on a site at the moment that is made up of 5 scenes. I have not
considered this problem during my site design planning stage and don't want to
have to redesign the whole site now that I'm almost done.

I would like to include sound on the site. I call the sound.swf to the
main.swf using a movie clip speakers_mc. Because I have 5 scenes I had to add
the movie clip to each scene with the following actionscript

speakers_mc.loadMovie("sounds.swf",1);

This is causing a problem because everytime you move to a new scene the
current sound file is interrupted and starts all over again because I presume
that the sound swf is reloaded everytime I change scenes.

How can I can the sound to play continuously while I jump between scenes?

Somebody suggested to use layered scenes. How do you do that?

Thanks
NSurveyor
11/25/2005 1:13:46 PM
Save your sound file (mp3) in the same directory as the fla.Then, on the first
frame of your movie, add:

if(!my_snd){
my_snd = new Sound();
my_snd.onLoad = function(s){
if(!s){
trace("Unable to load your sound file!");
}else{
this.onSoundComplete = function(){
this.start(0);
}
this.start();
}
}
my_snd.loadSound("whateverthefileis.mp3");
AddThis Social Bookmark Button