Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can sounds be muted and put back on ?

Status
Not open for further replies.

HappyFeet

Technical User
Sep 3, 2001
6
BE
Is there any way that makes pressing a button mute allsounds and turn the sound back on when being pressed again ? ::)
 
here is a fla that i kept from a long time back...shows ya how to do exactly that...pick it apart and see if you can get it...if not come back in and someone will help ya get it going...you could even just manipulate the button and change the music to make it suit your needs..then just drag it into your movie's timeline..

once again this is not my personal fla...just one of the many i have downloaded and used to learn from..


hope it helps..
e.gif


carlsatterwhite@endangeredgraphics.com
 
You can use the Sound() object. To make the button set the volume to zero and then set it back to its original value when pressed again set this up at the start of your movie...

mySound=new Sound();

...and attach this to your button...

on (release) {
myVolume = mySound.getVolume();
if (myVolume == 100) {
myVolume = 0;
} else if (myVolume == 0) {
myVolume = 100;
}
}

 
Sorry, no cigar virt2001.
The commands used in that movie stop the movie and restart it. Thanks anyway
 
yeh your right it would make the movie clip that it would be in start and stop..but it would not make the main timeline start and stop because you would have it in a movie clip on the main timeline..

have your button on the main time line callling the mc..

_root.yourmc.gotoAndPlay(1); or something like that..

and by the way...i don't smoke!!
e.gif


carlsatterwhite@endangeredgraphics.com
 
The solution from wangbar works but I'm not sure whether it will work across different scenes.
I'll get back on that.
thanks virt and wang
(and um I do smoke...)X-)
 
The script I gave you is global so it should work absolutely anywhere in your movie, even across scenes.

If want more control you can tie the script to individual movieClips using...

mySound = new Sound(myMovieClip);

which gives you control over individual sounds without shutting everything down at once.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top