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);
Share Article

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.

Put ’em up, put ’em up! Which one of you first? I’ll fight you both together if you want. I’ll fight you with one paw tied behind my back. I’ll fight you standing on one foot. I’ll fight you with my eyes closed… ohh, pullin’ an axe on me, eh? Sneaking up on me, eh? Why, I’ll… Ruff!

— Cowardly Lion