Random Colors in Flash ActionScript

less than 1 minute read

Want to set something to a random colour in Macromedia Flash? Once upon a time I did, and I found this code which did the trick.

Call changeColor(<target>) to set the color of <target> to a random one. Where changeColour is the function defined below.

function changeColor(targ)
{
  myColor = new Color(targ);
  myColor.setRGB(Math.random()*0xffffff);
}

Tags:

Categories:

Updated: