I am using a For Statement clock with Haxe and OpenFL, to create a Fade In & Fade Out effect for a Bitmap object (using alpha property). Do you have use other methods for that?
I am using a For statement instead of Sys.sleep(0.2); because it makes a "Loading" cursor icon and the program gets stuck.
The bitmap is called bmp and the timer is tmrSplash.
Source:
tmrSplash.run = function changeAlpha(): Void {
var f: Float = 1;
while (f <= 1 && f >= 0) {
bmp.alpha = f;
var a: Int = 0;
while (a < 500000000) {
a++;
if (a >= 500000000) {
a = 0;
}
f -= 0.0005;
trace(f);
}
tmrSplash.stop();
}
}
Thank you.