Flash - actionscript help..
Author
Discussion

GJR

Original Poster:

827 posts

311 months

Sunday 18th February 2007
quotequote all
Hi guys, hope someone can help..

I'm trying to write a small piece of actionscript that fades from one picture to the next on roll over and back to the original on roll out. This I've managed to do, but on roll out I'd like to cause the image to pause/delay before fading back to the original.

ie. the script waits 5 seconds before fading back to the original when the mouse moves out of the image. (script below)


Thanks

Graham





onClipEvent(load)
{
dir = 0;
speed = 3;
original._alpha = 100;
delay = getTimer() + 5 * 1000;


this.onRollOver = function()
{
dir = -1;
}
this.onRollOut = function(){
if (delay <= 5000)
{
dir = 0;
}
if (delay > 5000)
{
dir = 1;
}

useHandCursor = false;
}
}
onClipEvent(enterFrame)
{

temp = BW._alpha + speed*dir;
BW._alpha = Math.min(100,Math.max(temp,0));
}


Edited by GJR on Sunday 18th February 18:04