XTREEMMAK
12-04-2008, 03:58 PM
Hey guys,
I'm trying to create a fade in and fade out effect with just Action Script and I'm having a bit of trouble. I'm no Action Script expert but I was able to decode a few things to put some code together. This is basically what I'm trying to do:
on (rollOver) {
var myInterval = setInterval(FadeUp, 1000);
function FadeUp () {
for (i = 0; i < 30; i++) {
brightcounter +=1
clearInterval(myInterval);
setBrightness(FirstNews_btn,brightcounter);
trace(brightcounter);
}//End For Loop
}//End of Function
}//End
The brightness fuction is defined somewhere else so dont worry about that. The problem is between the for loop and the intervals. What it's doing is delaying the evaluation of the for loop for the interval seconds, rather than delaying each for loop evaluation by the interval second. How do I correct this?
So what it does is when you roll over something, it holds than evaluates the for loop. What I want it to do is roll over something, evaluate once, then wait by seconds defined, then evaluate again till i > 30.
I'm trying to create a fade in and fade out effect with just Action Script and I'm having a bit of trouble. I'm no Action Script expert but I was able to decode a few things to put some code together. This is basically what I'm trying to do:
on (rollOver) {
var myInterval = setInterval(FadeUp, 1000);
function FadeUp () {
for (i = 0; i < 30; i++) {
brightcounter +=1
clearInterval(myInterval);
setBrightness(FirstNews_btn,brightcounter);
trace(brightcounter);
}//End For Loop
}//End of Function
}//End
The brightness fuction is defined somewhere else so dont worry about that. The problem is between the for loop and the intervals. What it's doing is delaying the evaluation of the for loop for the interval seconds, rather than delaying each for loop evaluation by the interval second. How do I correct this?
So what it does is when you roll over something, it holds than evaluates the for loop. What I want it to do is roll over something, evaluate once, then wait by seconds defined, then evaluate again till i > 30.