Hi,
I made a function to fade a sound (global variable called daveSoundVolume ). It takes a number to fade to…First i put everything in a for loop, but then i realized how fast a for loop is, i considered using onEnterFrame function, but its not very efficient to have it call my fade function all the time!!!
So, my question is, is it an idea to use a time delay? How would i implement a time delay into my code? setInterval calls a function…but i need it to call i++ i guess.
Any ideas?
function fade(num){
if (daveSoundVolume < num){
daveSoundVolume += 1;
daveSound.setVolume(daveSoundVolume);
}
else if (daveSoundVolume > num){
daveSoundVolume -= 1;
daveSound.setVolume(daveSoundVolume);
}
else if (daveSoundVolume == 0){
daveSound.setVolume(num);
break;
}
}