Reduce jumpiness in your Flash with some Actionscript

As I saw many sites begin to integrate flash elements into their site, I decided to make one too.  I wanted to make one that included navigational elements with rollover effects. As I was building the flash, I noticed that the rollover effects were too “jumpy” or happened too fast. I thought by having a delay of a half-second would make it easier to navigate, and make it a bit more “professional-looking”. I attached this little bit of Actionscript to  the navigational “symbols” in the Flash file.

on(rollOver){displayTime = 30;

countDown = function(message){

displayTime--;

if (displayTime == 0){

clearInterval(timer);

gotoAndPlay('scene',1);

}

}

timer = setInterval(countDown, 15);

}

on(rollOut){clearInterval

(timer);}

So, if you look at the code above, and apply this to a symbol via actionscript, if you roll over the symbol, it will wait for a short period of time before flipping to the other scene (creatively called ’scene’ in the above code). Fool around with the 15 and 30 numbers in the above code to tweak the effect. Any questions?


Leave a Reply

About The Authors

Blogroll