Mute sound with a toggle switch

Is there a way to make this work with Action Script?

I need one button/toggle switch to mute sound on or off. I DO NOT want to just shut the sound off, I need to have it in the background just in case the user user wants to pick up the audio at the spot it is at in the animation–without restarting it.

any suggestions?


sure, just do this:

create a sound object with your music and then attatch it to your movie
then make a MC. inside the MC make two frames with a stop action on each. then place a button with alpha 0 that spans both frames (just for a hit area, but you wont see it), and have an image in each frame that corresponds to on or off (usually the “off” will be in the first frame because you will start the music when the thing starts). then on the buttons put actionscript to change the volume of the sound and play the mc to the other frame. - eg,
if(_root.newsound.getVolume() > 0){
} else {

Many thanks,
I will give that a try :slight_smile:
I am not very scift with action scripts yet…So whenb we think about trying this or that we usually wait for a slower day haha


heheh. well, let me know if it works out for you or if ya need anymore help. :wink:

Thank you very much for your help, It worked fine & now have a working sample for future reference, Just in case it is ever needed again.

Action Script is getting easier to understand in small scripts —am going to have to work my way up to the bigger scripts, in my spare time.

I am anxious for our client to actually upgrade their system to Flash Player 6. But that won’t happen for another several months. We are attempting to steer clear of a whole lot of scripting at least till then.

Thanks again for your help
Have a good day.