View Full Version : music on/off button
kabezz
01-09-2002, 11:03 AM
hello there,
i'm trying to find a way how to mute all sounds with a button. This same button should be like a switch on/off. How do I do that? I have background music and sounds on buttons (not on the switch one)
if anyone has some time to explain me this i really would appreciate. (didn't find a tuturial on this, so i presume it's something really simple, not?
thanks
Rupert
01-09-2002, 12:09 PM
you silence all currently playing sounds with:
on (release) {
stopAllSounds ();
}
If you want turn sounds on and off from the same button you will have to use the attachSound method.
Cheers,
Rupert
iceman4
01-09-2002, 04:56 PM
To make an on/off button make a sperate file for example you could name it soundload with just sound on the first frame and then save it and test the movie so you get the .swf file and then make your main movie and make sure that your main movie with the on/off button and the sound file are in the same folder or directory together. Then add something to this effect on your ON button.
on(release){
loadMovie(soundload.swf, 1)
}
and then on your off button you can have these actions
unloadMovie();
Hope this helps!
iceman4@sympatico.ca, if you need more help!
Kyle
kabezz
01-16-2002, 05:20 PM
thanx a lot iceman!
this is what i did: i created an extern file with two frames.
On the FIRST frame i imported the music loop (put the sync on event, loop on 1000 so that it's long enough). on the button that i created i put the action
on (release) {
play ();
}
on the frame i put the action
stop ();
On the SECOND frame: to the button the action
on (release) {
gotoAndPlay (1);
}
on the frame
stopAllSounds ();
stop ();
Then you just export the file in the same folder and indeed put on a frame in your main movie with the load movie action. And it works! The nice thing is that this way you have the loop on a background no matter what else you link to within your main movie.
This is my first ActionScripting, this is my first Flash orgasm!
Mamma; look no hands!!
p.s: no way i was going to get into the attach sounds method. Later, when i'm big maybe.
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.