PDA

View Full Version : Background looping music


mediaman
03-16-2001, 04:20 PM
Probably a simple one... I just don't get it. Can someone point me in the right direction to learn how to put a looping audio track in my movie as well as toggle it on and off. Thanks.

Marx
03-17-2001, 01:31 PM
Hi...

Probably the best way to add an audio track to your movie would be to load the music file as a seperate swf file. By doing this you reduce the download time of the main movie considerably.
The following example uses the sound object:

1) Open up a new swf file. On frame 1 add the script:

mySound = new Sound();
mySound.attachSound("liabrarySound");

This action attaches your music track from the liabrary. To attach a file from the library:

a) Select your file in the liabrary, click the options button then choose 'Linkage'.
b) In the linkage panel choose 'export this symbol' and type the name you want to give your file. I opted for' liabrarySound'.

2) Place two buttons on your stage, on and off.
On the button to start your music:

on (release) {
mySound.start(1,100);
}

This action will start your music after 1 second and loop it 100 times.

3) Button to stop your music:

on (release) {
mySound.stop();
}

Save this movie to the same folder as your main movie. To load this movie into your main movie use the load movie action:

on (release) {
loadMovieNum ("musicFile.swf", 5);
}

This action will load your audio track into level 5.

Hope this helps.

mediaman
03-19-2001, 12:47 AM
Thanks for the help... that sounds easy enough. Thanks for explaining it so well.

leky
11-24-2001, 12:30 PM
Hi... MARX

I also have a problem with the sound in loading second swf. I stucked with this for three days and couldn't solved.

Please go to this topic and read my situation, if you don't mind.

http://www.actionscripts.org/forums...=&threadid=6931

Cheers

Leky