setMask problems

I am having trouble using setMask on images that I am loading dynamically through XML. I have looked around and realize that I need to set a sort of delay so that the mask is not applied until the image has loaded. However, I still can’t get it to work. Here is my AS. Any ideas?

  
//---Load XML File---//
xmlData = new XML(); 
xmlData.ignoreWhite = true; 
xmlData.load("bigone.xml"); 
xmlData.onLoad = loadXML; 
//---Define thumbnail titles format---//
fmtThumbnail = new TextFormat();
fmtThumbnail.bold = true;
fmtThumbnail.size = 12;
fmtThumbnail.font = "Arial, Helvetica";
fmtThumbnail.color = 0x000000;
fmtThumbnail.align = "center";
//---load XML data into arrays---//
function loadXML(loaded) {
 if(loaded) {
  //---create arrays---//
  thumbnails = new Array();
  titles = new Array();
  images = new Array();
  links = new Array();
  abstracts = new Array();
  plusTitles = new Array();
  plusLinks = new Array();
  plusLinks = new Array();
  channels = new Array();
  dates = new Array();
  
  entryNode = this.firstChild.childNodes;
  for(i=0; i<entryNode.length; i++) {
   thumbnails* = entryNode*.firstChild.firstChild;
   titles* = entryNode*.childNodes[1].firstChild;
   images* = entryNode*.childNodes[2].firstChild;
   links* = entryNode*.childNodes[3].firstChild;
   abstracts* = entryNode*.childNodes[4].firstChild;
   //load titles and links for "Plus" stories
   plusNodes = entryNode*.childNodes[5].childNodes;
   for (j=0; j<plusNodes.length; j++) {
	plusLinks* = new Array();
	plusTitles* = new Array();
	plusTitles*[j] = plusNodes[j].childNodes[0].firstChild;
	plusLinks*[j] = plusNodes[j].childNodes[1].firstChild;
   }
   channels* = entryNode*.attributes.channels;
   dates* = entryNode*.attributes.date;
  }
 }
 else {
  trace ("File not loaded!");
 }
 //---call function to load graphics and text into Big One---//
 loadBigOne();
}
function loadBigOne(){
 _root.createEmptyMovieClip("tnContainer_mc", 1); //create container for thumbnails
 for (j=0; j<3; j++) {
  _root.tnContainer_mc.createEmptyMovieClip("tnSet"+j, j)//create 3 sets of thumbnails
  tnSet = _root.tnContainer_mc["tnSet"+j]; //tnSet = temp variable
  if (entryNode.length > 5) {
   createThumbs(entryNode.length); //load thumbs if 6+ stories
  }
  else {
   createThumbs(6); //load thumbs if less than 6 stories
  }
 } 
}
function createThumbs (entries){
 h=0; //h=array position; k=entry number
 for (k=0; k<entries; k++) {
  tnSet.createEmptyMovieClip("tn_mc"+k, k);
  //create text fields within movieclips (name, depth, x, y, width, height)
  tnSet["tn_mc"+k].createTextField("tnTitle", k, 0, 0, 110, 25);
  tnSet["tn_mc"+k].tnTitle._y = 95;
  tnSet["tn_mc"+k].tnTitle._width = 85;
  tnSet["tn_mc"+k].tnTitle.text = titles[h];
  tnSet["tn_mc"+k].tnTitle.setTextFormat(fmtThumbnail);
  tnSet["tn_mc"+k]._x = k*95;
  var image = tnSet["tn_mc"+k].createEmptyMovieClip("tnImg", k+20)
   image.loadMovie(thumbnails[h]);
  if (h <(entryNode.length-1)) {
   h++;
  }
  else {
   h=0;
  }
  var tnMask = tnSet["tn_mc"+k].attachMovie("tnMask_mc", "mask", k+10);
  loadMask(image, tnMask);
 }
}
function loadMask(image, tnMask){
 this.onEnterFrame = function(){
  var loaded = image.getBytesLoaded();
  var total = image.getBytesTotal();
  if(loaded = total){
   delete this.onEnterFrame;
   trace('after loading '+image._width +' x '+image._height);
   trace('after loading '+tnMask._width +' x '+tnMask._height);
   image.setMask(_root.mask);
  }
 }
}