ActionScript 3 Random Color

I wanted to test something with different colors, turns out it’s easy to pick a random color:

var box:Shape = new Shape();
var random_color:Number = Math.random() * 0xffffff;
box.graphics.beginFill(random_color, 1);
box.graphics.drawRect(0, 0, 100, 100);
box.graphics.endFill();
this.addChild(box);

Comments: None so far...be the first!

Leave a reply

Your email address will not be published. Required fields are marked *

Bad art was as good as good art. Grammar and spelling were no longer important. To be clean was no better than to be filthy. Good manners were no better than bad. Family life was derided as an outdated bourgeois concept. Criminals deserved as much sympathy as their victims. Many homes and classrooms became disorderly – if there was neither right nor wrong there could be no basis for punishment or reward. Violence and soft pornography became accepted in the media. Thus was sown the wind; and we are now reaping the whirlwind.

— Norman Tebbit