// Draws the checkerboard function drawBoard():void { var currColor:uint; var spaceX:int; var spaceY:int; // loop through x and y coordinates of board for (spaceX = 0; spaceX < 8; spaceX++){ for (spaceY = 0; spaceY < 8; spaceY++){ // alternate colors using modulous currColor = (spaceX%2 != spaceY%2) ? player1Color : player2Color; // draw square in graphics object // this will be drawn in the current timeline graphics.beginFill(currColor); graphics.drawRect(spaceX*spaceSize, spaceY*spaceSize, spaceSize, spaceSize); graphics.endFill(); } } }