Cropping an image and assigning it to a movie clip

I have created the following code. I want to load an external image. And break it into a specified number of rows and columns. How do I crop an image before assigning it to a movie clip? It currently works at generating the necessary size of each piece and placing the image where I want it. Trace statements show all calculations to be correct. i have the offsets in x,y coordinates of the portion of the larger image i want as well. Any ideas how to take just the pertion of the jpg I want and assign it to the movieclips? Then, how can I assign an action script to each movie clip it creates. Action script would be the same for each one… “on (click) {DO SOMETHING};”

Any help would be greatly appreciated… I want to do this to create a variety of different puzzles…including a sliding puzzle.

//set variables
puzzlepic=“puz1.jpg”; //name of image
imagewidth=300; //width of original image
imageheight=300; //height of original image
xstart=0; //start x coordinate
ystart=0; //start y position
rowmax=3; //number of rows
colmax=3; //number of columns
xsize=imagewidth/colmax; //calculate width of each cell
trace(“cell width=”+xsize);
ysize=imageheight/rowmax; //calculate height of each cell
trace(“cell height=”+ysize);//
//End of variables

//This function creates a grid of cells of the image.
//Each cell will have the same action script attached
function loadPuzzle(puz) {
id = 0; //piece number
xposition=xstart; //starting location on stage - x-coordinate
yposition=ystart; //starting location on stage - y-coordinate
for (var row = 0; row<rowmax; row++) {
for (var col = 0; col<colmax; col++) {
id++; //increment piece number
trace ("");
trace (“id=”+id);
container=“piece”+id; //Assign name of container for piece
trace (“container=”+container);
createEmptyMovieClip(container, id);//Create container for piece at level ID
loadMovie(puz, container); //Load image into container
//put container at current x,y position
setProperty (container, _x, xposition);
setProperty (container, _y, yposition);
//Calculate portion of image needed
trace (“Crop x coordinates are:”+xposition+" to “+(xposition+xsize));
trace (“Crop y coordinates are:”+yposition+” to "+(yposition+ysize));
trace (“position of clip is “+xposition+”,”+yposition);
xposition=xposition+xsize; //move right the width of one cell