all groups > flash actionscript > november 2005 >
You're in the

flash actionscript

group:

setVolume


setVolume wsu3333
11/5/2005 4:17:27 PM
flash actionscript:
I set up 3 buttons for the background music, the 3 buttons can play differnt
volume (100, 75, 0). When I run the movie, the music is playing fine at the
first time, when I press the mute button, the volume's value is 0 as well.
After that, I browse other pages, the music comes back, but the mute btn 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" );
};
Re: setVolume kglad
11/5/2005 4:33:49 PM
Re: setVolume kglad
11/7/2005 12:00:00 AM
use: my_sound.setVolume( 100 );
Re: setVolume wsu3333
11/7/2005 10:43:59 AM
:confused;

hmmmm....
AddThis Social Bookmark Button