# Loop help: XML attribute doesnt stay on each object of the loop

**URL:** <https://forum.kirupa.com/t/loop-help-xml-attribute-doesnt-stay-on-each-object-of-the-loop/160618>\
**Category:** flash\
**Created:** [August 27, 2005, 5:28pm UTC](https://forum.kirupa.com/t/loop-help-xml-attribute-doesnt-stay-on-each-object-of-the-loop/160618 "2005-08-27T17:28:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fourleafstudios](https://avatars.discourse-cdn.com/v4/letter/f/46a35a/32.png) [@fourleafstudios](https://forum.kirupa.com/u/fourleafstudios)\
**Post date:** [August 27, 2005, 5:28pm UTC](https://forum.kirupa.com/t/loop-help-xml-attribute-doesnt-stay-on-each-object-of-the-loop/160618/1 "2005-08-27T17:28:22Z")

</div>

Hi, i’m working on a gallery that loads thumbnails from an xml file into 3 columns and when you click on a thumbnail it opens a new window with the fullsized image in.

I have modified code from a gallery tutorial to load the thumbnails from a xml file. They are going in 3 columns at the moment (I don’t understand why but they are) but only the last image has a hand cursor when you rollover it, and then when you click on it, it traces “undefined” into the output box.

I have put

```auto
 trace(images_arr*.attributes.fullsize); 

```

just below the bit where it loads the thumbnails and it traces the right path from the xml file for each image.

Can someone help me get it to trace the right path from the xml file when you click on ALL the thumbnails, not just the last one.

Thank you so much in advance!

```auto
 function GenerateThumbs() {
     images_arr = images_xml.firstChild.childNodes;
     gap = 10;
     this.createEmptyMovieClip("thumb_mc",100000);
     thumb_mc._y = 10;
     thumb_mc._x = 10;
     for (var i = 0; i<images_arr.length; i++) {
          trace('generating thumbs'+i);
          this.thumb_mc.createEmptyMovieClip("thumb"+i+"_mc", i);
          this.thumb_mc.createEmptyMovieClip("thumb"+i+"_tmp_mc", 300);
          this.thumb_mc["thumb"+i+"_mc"]._x = ((i%3)*(67+gap));
          this.thumb_mc["thumb"+i+"_mc"]._y = Math.floor(i/3)*(67+gap);
          this.thumb_mc["thumb"+i+"_mc"].loadMovie(images_arr*.attributes.thumb);
          this.thumb_mc["thumb"+i+"_tmp_mc"].no = i;
          this.thumb_mc["thumb"+i+"_tmp_mc"].onEnterFrame = function() {
               var _mc = this._parent["thumb"+this.no+"_mc"];
               var l = _mc.getBytesLoaded();
               var t = _mc.getBytesTotal();
               if ((l>=t) && (t>1) && (_mc._width>1)) {
                    _mc.onRelease = function() {
                         trace(images_arr*.attributes.fullsize);
                    };
               }
          };
     }
}

var images_xml = new XML();
images_xml.ignoreWhite = true;
images_xml.onLoad = function(success) {
     if (success) {
          GenerateThumbs();
     } else {
          trace("Error loading XML file");
     }
};
images_xml.load("gallery.xml"); 

```
