random timing and color actionscripts

Date: 19th October 2007 at 1:45 am | Filed under: actionscript, development | Author: Sam Burdge

Here are the actionscripts used in the example swf. First the random timing script:

//random play
stop();
var delay = (Math.floor((Math.random())*10))*30000;
 
setTimeout(my_delayedFunction, delay);
 
function my_delayedFunction () {
 
play();
 
}

Random colour script:

//random color movieclip
onClipEvent(load){
 
r=Math.floor(Math.random()*255)
 
g=Math.floor(Math.random()*255)
 
b=Math.floor(Math.random()*255)
 
colourobj=new Color(this)
 
colourobj.setRGB(r<<16|g<<8|b)
 
}

Leave a Comment