# Sound Function Conflict

**URL:** <https://forum.kirupa.com/t/sound-function-conflict/50688>\
**Category:** flash\
**Created:** [May 5, 2004, 3:18pm UTC](https://forum.kirupa.com/t/sound-function-conflict/50688 "2004-05-05T15:18:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wyclef](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@wyclef](https://forum.kirupa.com/u/wyclef)\
**Post date:** [May 5, 2004, 3:18pm UTC](https://forum.kirupa.com/t/sound-function-conflict/50688/1 "2004-05-05T15:18:02Z")

</div>

Hi,

How can I change the following so it won’t conflict with sounds inserted manually in keyframes. Currently when this function is active, the loop sound works but the other sounds don’t play…

```auto

soundTrack = new Sound();
soundTrack.attachSound("loop");
soundTrack.setVolume(0);

soundTrack.fadeIn = function(speed) {
        var vol = this.getVolume()+speed;
        this.setVolume(vol);
        display = this.getVolume();
        if (this.getVolume()>17) {
                this.setVolume(17);
                clearInterval(this.interval);
        }
};
soundTrack.fadeOut = function(speed) {
        var vol = this.getVolume()-speed;
        this.setVolume(vol);
        display = this.getVolume();
        if (this.getVolume()<0) {
                this.setVolume(0);
                this.stop();
                this.playing = false;
                clearInterval(this.interval);
        }
};
vol_offBTN.onRelease = function() {
       	vol_offBTN._visible = false;
		vol_onBTN._visible = true;	
	   if (!soundTrack.playing) {
                soundTrack.start(0, 999);
                clearInterval(soundTrack.interval);
                soundTrack.interval = setInterval(soundTrack, "fadeIn", 500/12, 1);
                soundTrack.playing = true;
        }
};
vol_onBTN.onRelease = function() {
       	vol_offBTN._visible = true;
		vol_onBTN._visible = false;
	   if (soundTrack.playing) {
                clearInterval(sndObj.interval);
                soundTrack.interval = setInterval(soundTrack, "fadeOut", 200/12, 1);
        }
};
soundTrack.start(0, 999);
soundTrack.interval = setInterval(soundTrack, "fadeIn", 500/12, 1);
	if (!soundTrack.playing) {
		soundTrack.start(0, 999);
		clearInterval(soundTrack.interval);
		soundTrack.interval = setInterval(soundTrack, "fadeIn", 500/12, 1);
		soundTrack.playing = true;
    }

```
