public class Main extends Sprite { public function Main ( ) { var rects:Array = new Array( ); for (var i:int = 0; i < 20; i++) { rects[i] = new Shape( ); rects[i].graphics.lineStyle(1); rects[i].graphics.beginFill(Math.floor(Math.random( )*0xFFFFFF), 1); rects[i].graphics.drawRect(0, 0, 100, 50); rects[i].x = Math.floor(Math.random( )*500); rects[i].y = Math.floor(Math.random( )*400); addChild(rects[i]); }