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

**URL:** <https://forum.kirupa.com/t/xml-thumbnail-gallery-works-when-published-in-as1-when-published-in-as2-it-fails/251603>\
**Category:** flash\
**Created:** [February 11, 2008, 1:33am UTC](https://forum.kirupa.com/t/xml-thumbnail-gallery-works-when-published-in-as1-when-published-in-as2-it-fails/251603 "2008-02-11T01:33:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![muddymac](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@muddymac](https://forum.kirupa.com/u/muddymac)\
**Post date:** [February 11, 2008, 1:33am UTC](https://forum.kirupa.com/t/xml-thumbnail-gallery-works-when-published-in-as1-when-published-in-as2-it-fails/251603/1 "2008-02-11T01:33:15Z")

</div>

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”);
