// Generate a grid when giving in columns and rows
function generateGrid( object:Sprite, rows:Number, column:Number, w:Number, h:Number ):void {
var totalWidth:Number = column * w;
var totalHeight:Number = rows * h;
// Do for loop for columns
for(var i:Number = 0; i <= column ; i++) {
object.graphics.moveTo( w * i, 0 );
object.graphics.lineTo( w * i, totalHeight );
}
// Do for loop for rows
for(var j:Number = 0; j <= rows ; j++) {
object.graphics.moveTo( 0, h * j );
object.graphics.lineTo( totalWidth, h * j );
}
// Now we have a grid
}
var s:Sprite = new Sprite();
s.graphics.lineStyle(1, 0x000000);
addChild(s)
generateGrid(s, 3, 3, 100, 100);