Random Colors in Flash ActionScript

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);
}

Comments