[as2] checkerboard background


function set_checkerboard() {
    import flash.display.*;
    import flash.geom.*;
    var board_size:Number = Stage.width;
    var block_size:Number = 2;
    /*
    //gingham checker pattern
    var block1_color:Number = 0xff000000;
    var block2_color:Number = 0xff222222;
    var block3_color:Number = 0xff666666;
    var block4_color:Number = 0xff444444;
    */
    //2-color checkerboard pattern
    // 0xff
    var block1_color:Number = 0xff000000;
    var block2_color:Number = 0xff;
    var block3_color:Number = 0xff;
    var block4_color:Number = 0xff000000;
    var bmpd:BitmapData = new BitmapData(block_size*2, block_size*2);
    var rect1:Rectangle = new Rectangle(0, 0, block_size, block_size);
    var rect2:Rectangle = new Rectangle(0, block_size, block_size, block_size*2);
    var rect3:Rectangle = new Rectangle(block_size, 0, block_size*2, block_size);
    var rect4:Rectangle = new Rectangle(block_size, block_size, block_size*2, block_size*2);
    bmpd.fillRect(rect1, block1_color);
    bmpd.fillRect(rect2, block2_color);
    bmpd.fillRect(rect3, block3_color);
    bmpd.fillRect(rect4, block4_color);
    this.checkerboard.createEmptyMovieClip("bmp_fill_mc", 0);
    with (checkerboard.bmp_fill_mc) {
        matrix = new Matrix();
        repeat = true;
        smoothing = true;
        beginBitmapFill(bmpd);
        //, matrix, repeat, smoothing);
        moveTo(0, 0);
        lineTo(0, board_size);
        lineTo(board_size, board_size);
        lineTo(board_size, 0);
        lineTo(0, 0);
        endFill();
    }
}

Example here