Snapping to Grid

Hi Guys,

I have created a grid using a script that tiles “10"x"10” square across the stage:


function tileGrid(){
    
    grid_width     = 10;
    grid_height = 10;
    //
    x_max = Math.round(Stage.width/grid_width);
    y_max = Math.round(Stage.height/grid_height);
    
    for (x=0; x<x_max; x++)
    {
        for (y=0; y<y_max; y++)
        {
            bg = _root.attachMovie("grid", "gd"+x+y, 
                this.getNextHighestDepth());
            bg._x = grid_width*x;
            bg._y = grid_height*y;
        }// End of inner loop
    }// End of outer loop
};

How can I go about making a movieClip object or graphic ‘snap’ to that grid? Is there a function out there, or a script? Please please please can anybody help me.

Many Thanks

PrinceTaj :slight_smile: