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…
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;
}