Loop problems

 
x=0;
sx=0;
y=0;
sy=0;
spacex=40;
spacey=40;
picnum=57;
column=5;
row=Math.ceil(picnum/column);
 for (y=0; y<row; y++) {
  sx=0;
  for (x=0; x<column; x++) {
   pic.duplicateMovieClip("pic"+i, this.getNextHighestDepth(), {_x:pic._x+sx, _y:pic._y+sy});
   sx+=spacex;
   i++;
   }
   sy+=spacey;
   }

how can i load jpegs from a dir into this movie or you have any simple script does same function?