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 = <strong>Math.random() * 0xffffff;</strong>
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

Please fill in the form fields and improve Skynet by completing the captcha!

Thank you! All comments are moderated so yours will appear shortly.

And over here, our bass player, the Duke of Spook, the Doc of Shock, The Man with No Tan, please say hello to Death himself, the Grim Reaper!

— Bill S. Preston, Esq