View Full Version : Random Color Generator go on automaticaly
Jeej
November 13th, 2005, 10:57 AM
Hello,
I have read the tut about Random Color Generator. I want that it keep changing collors. It starts already when the flash movie is loaded but it stand stil after 1 color made. Does anyone know how to make it keep making more colors?
THNX JeeJ.
Sorry for my bad English.:(
var i
November 13th, 2005, 11:15 AM
Hello,
I have read the tut about Random Color Generator. I want that it keep changing collors. It starts already when the flash movie is loaded but it stand stil after 1 color made. Does anyone know how to make it keep making more colors?
THNX JeeJ.
Sorry for my bad English.:(
I don`t know the tutorial but all you need to do is
create a movieclip -give it instance name mc
click the first frame,open the actions panel and type
col = new Color(mc);
col.setRGB(Math.floor(Math.random()*0xFFFFFF));
myinterval = setInterval(function () {
col.setRGB(Math.floor(Math.random()*0xFFFFFF));
}, 1000);
Jeej
November 13th, 2005, 01:12 PM
I don`t know the tutorial but all you need to do is
create a movieclip -give it instance name mc
click the first frame,open the actions panel and type
col = new Color(mc);
Col.setRGB(Math.floor(Math.random()*0xFFFFFF));
myinterval = setInterval(function () {
Col.setRGB(Math.floor(Math.random()*0xFFFFFF));
}, 1000);
The tutorial's url is http://www.kirupa.com/developer/flash5/randomcolor.htm
gregorandrew
March 12th, 2008, 08:09 PM
How would I make the above script [by var i] change colors smoothly into each other?
joran420
March 12th, 2008, 08:17 PM
i think you would need to use RGB values and just increment or drop them over time
like 0xFFFFFF is really the same as red:255,green:255,blue:255
and if you wanted to fade to blue (which would be 0x0000FF or red:0, green:0 , blue 255)
just lower the red and green values using an interval or an on enter frame then convert RGBtoHex using (red<<16 | green<<8 | blue)
and set the color of the clip
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.