Tag: flicker

Objective:

To create a method that causes a random flickering effect.

To set this up , create a movieclip on stage and give it an instance name of myCoverUp. The script below, declares a variable on the main timeline so it can be used outside the scope of the function flicker(). Then the function flicker chooses a random number between 0-50, toggles the visibility of myCoverUp, then clears and creates a new interval timer using the random number as a delay.

var nextInterval = 100;
flickerInterval = setInterval(flicker, nextInterval);
function flicker(){
    nextInterval = Math.random() * 50;
    myCoverUp._visible = !myCoverUp._visible;
    clearInterval(flickerInterval);
    flickerInterval = setInterval(flicker, nextInterval);
} 
Leave a Comment :, , , , , more...

Get Adobe Flash playerPlugin by wpburn.com wordpress themes

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!