Flash grid gallery help

hi im trying to create a very dynamic flash gallery through grids i get the grids created as movieclips the problem im having is put a picture into the movieclip from xml, the xml is loading.

gridx=30;
gridy=30;
num=0;
for (var i=0;i < 4;i++)
{
  for (var j=0;j < 2;j++)
  {
    dot.duplicateMovieClip("dot"+num,num);
    mc=this["dot"+num];
    mc._x=gridx*i;
    mc._y=gridy*j;
    insert = "dot"+num;
    insert.loadMovie(pic[num]);
    num++;
  }
}


dot._visible=0;

when i run this code no pictures are populating the movies at the insert.loadMovie(pic[num]) i get an error saying can not open url on my local system but i am not accessing my local system with that.

but if i manually go in and upload a picture and put in this code it puts the picture into the movieclip.

dot2.loadMovie("pic.jpg");

seeing as this is a dynamic gallery i need to do what is actually in my code so that it can grab from the xml.
Please let me know what i am doing wrong THANKS in advance.

also how can i attach code to one movieclip that will duplicate to the others to open a picture full scale. i tried this.onrelease but didnt work