# mp3 fading mute button?

**URL:** https://forum.kirupa.com/t/mp3-fading-mute-button/293728
**Category:** flash
**Created:** [August 2, 2009, 7:46pm UTC](https://forum.kirupa.com/t/mp3-fading-mute-button/293728 "2009-08-02T19:46:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![andyryan](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@andyryan](https://forum.kirupa.com/u/andyryan)
#### Post date: [August 2, 2009, 7:46pm UTC](https://forum.kirupa.com/t/mp3-fading-mute-button/293728/1 "2009-08-02T19:46:03Z")

</div>

hi,

i have an mp3 that plays as background music to my website with a mute button that fades the music in or out. This works using the code below that i found on another site.

My problem is i would like to have this music added to an external swf that i could load into my main site in order to decrease the main site file size. When i load swf however, the music doesnt play. the button appears (which is also in the external swf) so i know that the movie is loading but no sound plays.

Can anyone help??

some\_sound = new Sound();  
some\_sound.attachSound(“Kevin Spacey 16bit.mp3”);  
some\_sound.start();  
some\_sound.setVolume(100);  
sound\_set = true;  
//  
function increase\_volume() {  
counter++;  
some\_sound.setVolume(counter);  
if (counter\>=100) {  
clearInterval(my\_int);  
}  
}  
//  
function decrease\_volume() {  
counter++;  
some\_sound.setVolume(100-counter);  
if (counter\>=100) {  
clearInterval(my\_int);  
}  
}  
//  
sound\_status = “normal”;  
//  
this.onRelease = function() {  
clearInterval(my\_int);  
counter = 0;  
//  
if (sound\_status == “normal”) {  
my\_int = setInterval(decrease\_volume, 1);  
sound\_status = “muted”;  
this.gotoAndStop(2);  
} else {  
my\_int = setInterval(increase\_volume, 1);  
sound\_status = “normal”;  
this.gotoAndPlay(2);  
}  
};  
//
