flash on 2012-5-30
/**
* Copyright Yuji.Arai ( http://wonderfl.net/user/Yuji.Arai )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/s9QA
*/
package {
import flash.events.MouseEvent;
import flash.display.Sprite;
public class FlashTest extends Sprite {
// [SWF(width = 465, height = 465]
public function FlashTest(){
var rows:uint=8;//横の個数
var lines:uint=12;//縦の個数
var d:Number=5;//四角の間隔
var w:Number=(stage.stageWidth-d)/rows-d;//四角形の幅
var h:Number=(stage.stageWidth-d)/lines-d;//四角形の高さ
for (var i:int=0; i<lines; i++){
for (var j:int=0; j<rows; j++){
var fillColor:uint=0xFFFFFF*Math.random();
var tile_sp:Sprite=new Sprite();
tile_sp.graphics.beginFill(fillColor);
tile_sp.graphics.drawRect(0,0,w,h);
tile_sp.graphics.endFill();
tile_sp.x=d+(w+d)*j;
tile_sp.y=d+(h+d)*i;
addChild(tile_sp);
}
}
}
}
}