Well, i wanted to start this thread because i hate game with music or sounds with no mute button. If everyone want to put his own techniques in here, just to help (that’s the programming forum), here is mine:
This will create a rollover/rollout/disappear effect on the button so that you don’t always have a big mute button on your screen, it only appears when u rollover it.
Here is how i do it (some crap AS code :p):
put this code on your frame where the button is
var son_bouclier:Sound = new Sound();
son_bouclier.attachSound("bouclier");
_root.son_on = 1;
this.btn_son._alpha = 30;
if (_root.son_on == 1) {
_root.son_bouclier.setVolume(0);
} else {
_root.son_bouclier.setVolume(30);
}
//BOUTON SON ON/OFF
this.btn_son.onRelease = function() {
if (_root.son_on == 1) {
_root.son_bouclier.setVolume(0);
this.gotoAndStop(2);
_root.son_on = 0;
} else {
_root.son_bouclier.setVolume(30);
this.gotoAndStop(1);
_root.son_on = 1;
}
};
this.btn_son.onRollOver = function()
{
this.onEnterFrame = function() {
if (this._alpha <= 100) {
this._alpha += 5;
}
};
};
this.btn_son.onRollOut = function()
{
this.onEnterFrame = function() {
if (this._alpha >= 30) {
this._alpha -= 5;
}
};
};
Then create a movie clip named btn_son on your scene. In this MC, two images with a stop(); on each. First is for the Sound ON graphics and second is for sound OFF graphics.
Import a sound in your library and go right click>Properties and set the link identifier to “bouclier”. Well that’s some french things, you can change it of course, but don’t forget to search and replace on the AS code.
I’m sure you can do it with a new empty MC like luksy explained on the other topic but well, i didn’t have energy to try ;)
Experiment !
If other devs want to post a better technique, i’m sure we can finish this thread with the best mute tutorial ever ^^
pixtiz
Edited 03/14/07 by arcaneCoder. Reason: Added code formatting for readability ;)

