# setVolume

**URL:** https://forum.kirupa.com/t/setvolume/168235
**Category:** flash
**Created:** [November 5, 2005, 6:43am UTC](https://forum.kirupa.com/t/setvolume/168235 "2005-11-05T06:43:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![wsu3333](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@wsu3333](https://forum.kirupa.com/u/wsu3333)
#### Post date: [November 5, 2005, 6:43am UTC](https://forum.kirupa.com/t/setvolume/168235/1 "2005-11-05T06:43:20Z")

</div>

I set up 3 buttons for the sound, they are 100(loud), 75, and 0(mute). When I run the movie, it was working fine at the first time when I press the mute button. After that, while I am reviewing my other pages, the sound comes back, and the mute button still on. Below is the code, please help, thank you in advance.

var my\_sound = new Sound();

my\_sound.loadSound( “music/night.mp3”, true );  
my\_sound.onSoundComplete = function() {  
my\_sound.loadSound( “music/night.mp3”, true );  
};

b\_1.enabled = 0;  
b\_1.gotoAndStop( “disabled” );

b\_1.onRelease = function(){  
reset\_sound\_buttons();  
this.gotoAndStop( “disabled” );  
this.enabled = 0;  
my\_sound.setVolume( 75 );  
};

b\_2.onRelease = function(){  
reset\_sound\_buttons();  
this.gotoAndStop( “disabled” );  
this.enabled = 0;  
my\_sound.setVolume( 100 );  
};

b\_mute.onRelease = function(){  
reset\_sound\_buttons();  
this.gotoAndStop( “disabled” );  
this.enabled = 0;  
my\_sound.setVolume( 0 );  
};

reset\_sound\_buttons = function() {  
b\_1.enabled = 1;  
b\_1.gotoAndStop( “\_up” );  
b\_2.enabled = 1;  
b\_2.gotoAndStop( “\_up” );  
b\_mute.enabled = 1;  
b\_mute.gotoAndStop( “\_up” );  
};  
:hair:
