Problem with tiled background. Urgent help please!

Hi guys!

I’m trying to tile the background of a movieClip with a set of small squares, called grid. However, the script only attaches on instance of grid. I don’t understand why this is. Below is my code exert:


function tileGrid() { 

      grid_width  = 20;
    grid_height = 20;
    //
    x_max = Math.round(canvas_mc._width/grid_width);
    y_max = Math.round(canvas_mc._height/grid_height);
   
    for (x=0; x<x_max; x++)
    {
        for (y=0; y<y_max; y++)
        {
            bg = this.canvas_mc.attachMovie("grid", "gd"+x+y,
                100+x*y);
            bg.duplicateMovieClip({_x: grid_width*x, _y: grid_width*y});
     
        }// End of inner loop
    }// End of outer loop
}

tileGrid();


If anybody could explain a reason for this, or remedy my code, I would be very grateful.

Many thanks

TAJ

P.S. Please find attached a copy of the source.