XML thumbnail gallery works when published in as1, when published in as2 it fails

if anyone can help, I believe it’s a scoping issue???

//import mx.transitions.;
//import mx.transitions.easing.
;

// Create a new XML object.
//var myPhoto:XML = new XML();
myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
if (success) {

trace(“success”);

var numimages = this.firstChild.childNodes.length;
spacing = 70;
j = 0;

for (i=0; i<numimages; i++) {
picHolder = this.firstChild.childNodes*;
thumbHolder = thumbnails.createEmptyMovieClip(“thumbnail”+i, i);
thumbLoader = thumbholder.createEmptyMovieClip(“thumbnail_image” , 0);
thumbLoader.loadMovie(picHolder.attributes.thmb);
trace(picHolder.attributes.thmb);
thumbHolder.style = picHolder.attributes.style;
thumbHolder.designer = picHolder.attributes.designer;
thumbHolder.cost = picHolder.attributes.cost;
thumbHolder.main = picHolder.attributes.main;
thumbHolder.caption = picHolder.attributes.caption;

thumbLoader.main = loader.createEmptyMovieClip(“main_image”, 0);

/////// load movie /////////

/*var mcl_obj:Object = new Object();
mcl_obj.onLoadInit = function(loader:MovieClip) {

//image_src._alpha=0;
new Tween(loader, “_alpha”, Strong.easeIn, 0, 100, .8, true);
};

var my_mcl:MovieClipLoader = new MovieClipLoader();
my_mcl.addListener(mcl_obj);
my_mcl.loadClip(picHolder.attributes.main);*/

////////// end ////////////

if (j == 4) {
y += 50;
x = 0;
j = 0;
}
thumbHolder._y = y;
thumbHolder._x = j*spacing;
j++;

thumbHolder.onRollover = function() {
roll.gotoAndPlay(2);
roll.startDrag(this);
roll.test_txt.text = this.caption;
};
thumbHolder.onRollout = function() {
roll.gotoAndStop(1);
roll.test_txt.text = " ";
};
thumbHolder.onRelease = function() {
roll.gotoAndStop(1);
loader.loadMovie(this.main);
style.htmlText = this.style;
designer.htmlText = this.designer;
cost.htmlText = this.cost;
};
}
}
};
myPhoto.load(“xmlphoto.xml”);