
Код AS3:
package strokes.view
{
import flash.display.Sprite;
/**
* @author Maxim
*/
public class GameView extends Sprite
{
public static const CELL_WIDTH: int = 10;
private var _rows: int;
private var _columns: int;
private var _width: int;
private var _height: int;
public function GameView(rows: int, columns: int)
{
super();
_rows = rows;
_columns = columns;
_width = _columns * CELL_WIDTH;
_height = _rows * CELL_WIDTH;
init();
}
private function init(): void
{
graphics.beginFill(0xEEEEEE);
graphics.lineStyle(2.0);
graphics.drawRect(0, 0, _height, _width);
graphics.lineStyle(1.0, 0x999999);
for (var i: int = 1; i < _columns; i++) {
graphics.moveTo(i * CELL_WIDTH, 0);
graphics.lineTo(i * CELL_WIDTH, _height);
}
for (i = 1; i < _rows; i++) {
graphics.moveTo(0, i * CELL_WIDTH);
graphics.lineTo(_width, i * CELL_WIDTH);
}
}
}
}