Alpha fade grid

EDIT: Ok, final version…


stagewidth = Stage.width; // Width of your stage;
squaresrow = 16; // Number of squares in a row.
col = 0x648502; // Colour of squares.
loc = 1;
function dopx() {
al=loc;
var pos = [0,0];
for (i=0;i<(squaresrow*squaresrow);i++) {
    _root.beginFill(col,al);
    _root.moveTo(pos[0],pos[1]);
    _root.lineTo(pos[0]+(stagewidth/squaresrow),pos[1]);
    _root.lineTo(pos[0]+(stagewidth/squaresrow),pos[1]+(stagewidth/squaresrow));
    _root.lineTo(pos[0],pos[1]+(stagewidth/squaresrow));
    _root.lineTo(pos[0],pos[0]);
    al -= 100/(squaresrow*squaresrow);
    pos = [pos[0]+(stagewidth/squaresrow),pos[1]];
    if (pos[0]==stagewidth || pos[0]>stagewidth) {
        pos = [0,pos[1]+(stagewidth/squaresrow)];
    }
}
loc++;
}
onEnterFrame = function() {
    _root.clear();
    dopx();
}

-Ben