Pls help, I have spent a week trying to find this bug.
I have a function that fades out sound. It works perfectly well, yet the mirror of that which is supposed to fade IN my sounds does not start looping.
Code as follows:
//**** Query Dec 28 2010 ****//
function fadeinsong(e:Event = null): void // To gradually fade in volumes
{
e.currentTarget.removeEventListener(Event.COMPLETE, fadeinsong);
var Fade_in_timer:Timer = new Timer(20, 50); // 20ms for up to 50 x
timers.push(Fade_in_timer); // into array for timer handling
Fade_in_timer.addEventListener( TimerEvent.TIMER, VOL_up,false, 0, true);
function VOL_up(e:TimerEvent):void
{
setVol +=dV; // increment dV is 0.025 units
adjustVolume(e); // updates all volumes
if ( setVol >= Vol ) { // to break
Fade_in_timer.stop();
}
} // end func
Fade_in_timer.start();
}
The issue is that the Fade_in_timer calling VOL_up never starts looping.
And the very same code works well when dV is subtracted from setVol
Note: setVol, dV and Vol are global variables defined at the top of my main code. “timers” is an array to keep track of all new timers in case I need to stop them all and remove them.
Note: the other fadeout function that works well only differs in the names of the timer and the stop criterion and that setVol is decreased gradually.
I have tried “everything” - please help!!!
Cheers,
Jaxz