Sound Function Conflict

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

???

Why would you want both a song controlled by AS and a song on the timeline ? Seems quite pointless to me.

I want a song controlled by AS and sound fx on the timeline…

Why not control both with AS ? Sound on the timeline is quite hard to control.

can you give me an example of how I would accomplish that if I wanted to use 2-3 different sounds? like clicking sounds and swoosh sounds? for buttons and transitions…etc…

You just create a different Sound object, and you do anything you want with it as you normally would. This site may be of help.

how can i troubleshoot why certain sounds don’t play on the timeline?

Well, to be honest, I don’t know much about timeline sounds, except that they’re hard to control. That’s why I always use AS to control my sounds … I wouldn’t know why the timeline sound doesn’t work.

If you have sounds on the timeline don’t they refer their target to the movie?
Then when you use

        
soundTrack = new Sound();
soundTrack.attachSound("loop");
//

without targetting, it refers again to the movie and replace the sound in the timeline?
try:


_root.createEmptyMovieClip("soundHolder", 1000);      
soundTrack = new Sound(soundHolder);
soundTrack.attachSound("loop");

Hope that helps;)

scotty(-:

Thanks! That solved the problem!