PDA

View Full Version : background sounds



illcavi2000
04-15-2007, 05:48 PM
i am having a problem with importing sound and having it play on ONLY my main page (frame 1). frame 2 through the rest of them are linked to from the main page, but i dont want the sound playing on these pages (frames)

mburt
04-15-2007, 06:57 PM
Put the sound HTML in the frame page, not the main page. That way it will only play in the frame, also if you're trying to use bgsound, don't. Use embed:

<embed src="path/to/mymusic.mp3" hidden="true" autoplay="true">


//EDIT: Ooops... I didn't know this was in the flash section, thought it was HTML. Sorry, but our Flash expert has left temporarily, and not many others know flash that well.

nwalton
04-18-2007, 06:02 AM
If you want to have exact control over a sound, you should use the Sound object. You can either load a sound from a file, or attach a sound that is in the library. Once you have the sound defined as a variable, you can control it with the Sound.start() and Sound.stop() methods as needed.

For example, on Frame 1:

if (my_sound == undefined){
var my_sound:Sound = new Sound();
my_sound.loadSound("song1.mp3", false); //The second parameter says whether this is a streaming sound or not.
//"false" will make the entire sound load before it starts playing
} else {
my_sound.start();
}

This will either load the sound into the object, or if it's already loaded, will start playing it. Then on all other frames, you can add


my_sound.stop();

The documentation has a lot of other good info about the Sound class too.