PDA

View Full Version : random color



Dojjjan
February 9th, 2009, 01:46 AM
Hi,

i'm currently using tween max to tint a background mc to a random color (like this: TweenMax.to (bakgrund_mc, 4, { tint:(Math.random() * 0xFFFFFF)}); ) but i would like to have random colors but exclude darker colors(it makes the black text im using really hard to read), is that possible? anyone knows how to do this?

ty

.ral:cr
February 9th, 2009, 02:13 AM
i'm not shure because i didn't tried, but that representation of the color is an Int, so you probably can do a comparison : if (Math.random() * 0xFFFFFF < 0x333333) // find another color

Dojjjan
February 9th, 2009, 03:05 AM
it works! perfect! thank you