I would like a backgroundpic to fade in and out. To make it mysterious I would like this to occour in random time. How do I do this the best way?
thx
I would like a backgroundpic to fade in and out. To make it mysterious I would like this to occour in random time. How do I do this the best way?
thx
one way of doing it…
onClipEvent (load) {
Rate = 2; // however fast you want your pic to fade in/out
fade = Rate; //you'll see why in a sec
}
onClipEvent (enterFrame) {
if (!random(1000)) {
fadeRate = -Rate;
}
_alpha += fadeRate;
if (_alpha <= 0) {
fadeRate = Rate;
}
}
not the only, most efficient way, but this code basically loops until random(1000) hits 0 at which point the image fades out. once it is completely faded out, it fades back in and waits yet again. Mind you, this code is spontaneous so it may fade back out as it’s fading in, since it uses a random number generator.
Hi thoriphes
It´s pretty mutch what I want to happen but there is one thing that feels pretty wierd and that is that the pic gets overexposed (excuse my bad english) when it fades over 100% which I dont like. Im not really the code guy so do you mind explaining the if(!random(1000)) line for me. Im really thankful for all your help.
thanx
I forgot… is there a way to make it wait when it´s faded out?
:: Copyright KIRUPA 2024 //--