flash on 2011-3-25
♥0 |
Line 20 |
Modified 2011-03-25 15:51:54 |
MIT License
archived:2017-03-20 06:52:08
ActionScript3 source code
/**
* Copyright yama3 ( http://wonderfl.net/user/yama3 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/7wmp
*/
package {
import flash.display.Sprite;
[SWF(width="465",height="465",backgroundColor="0xffffff",frameRate="60")]
public class FlashTest extends Sprite {
private const NUM_TILE:uint = 10;
private const BORDER_SIZE:uint = 1;
public function FlashTest() {
var tileSize:uint = (stage.stageWidth / NUM_TILE) - BORDER_SIZE;
trace(tileSize);
for(var i:uint = 0; i < NUM_TILE; i++)
for(var j:uint = 0; j < NUM_TILE; j++)
drawRandomTile(i * (tileSize + BORDER_SIZE), j * (tileSize + BORDER_SIZE), tileSize, tileSize);
graphics.endFill();
}
private function drawRandomTile(x:Number, y:Number, width:Number, height:Number):void {
graphics.beginFill(Math.random() * 0xffffff);
graphics.drawRect(x, y, width, height);
}
}
}