Welcome to WebmasterWorld Guest from 54.204.165.156

Forum Moderators: open

how do i get my volume up?

   
11:43 pm on Jan 11, 2007 (gmt 0)

10+ Year Member



my question has two parts...

i'm using the script below to fade out a song in the background. it works but on the next scene i need the volume back up again for a different track. how do i reverse what the script does?

also, when i jump to the next scene will the audio from the first scene be still playing? if so i need a way to stop the first track at the end of the first scene (it can be done abruptly since it will be faded out)

i have my audio attached to the main timelines by the way

// timew to play before fading out
FADEDELAY = 0000; // 25000 ms = 25 s

// length of the fading
FADELENGTH = 2000; // 2s

// methods to handle the fading

this.doFade = function() {
var elapsed = getTimer() - this.startTime;
if (elapsed >= this.FADELENGTH) {
this.s.setVolume(0);
this.s.stop();
delete this.onEnterFrame;
} else {
this.s.setVolume(100 - (elapsed*100/this.FADELENGTH));
}
}

this.startFading = function() {
clearInterval(arguments.callee.fadeID);
this.startTime = getTimer();
this.s = new Sound(this);
this.s.setVolume(100);
this.onEnterFrame = this.doFade;
}

// go for it
this.startFading.fadeID = setInterval(this, "startFading", FADEDELAY);

 

Featured Threads

Hot Threads This Week

Hot Threads This Month