# Probleme creating a thumbnails loaded via xml+ onRelease fonction for each thumb

**URL:** <https://forum.kirupa.com/t/probleme-creating-a-thumbnails-loaded-via-xml-onrelease-fonction-for-each-thumb/297932>\
**Category:** Uncategorized\
**Created:** [October 10, 2009, 5:18pm UTC](https://forum.kirupa.com/t/probleme-creating-a-thumbnails-loaded-via-xml-onrelease-fonction-for-each-thumb/297932 "2009-10-10T17:18:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![savagestudio](https://avatars.discourse-cdn.com/v4/letter/s/43a26b/32.png) [@savagestudio](https://forum.kirupa.com/u/savagestudio)\
**Post date:** [October 10, 2009, 5:18pm UTC](https://forum.kirupa.com/t/probleme-creating-a-thumbnails-loaded-via-xml-onrelease-fonction-for-each-thumb/297932/1 "2009-10-10T17:18:35Z")

</div>

Hello evryone ! Im trying to create via xml and a for() loop a thumbnails wiewer and each thumbnail have a simple onrelease function…Im getting headake with my script  
Maybe someone can help me with this one ???  
At the end of the script you can remove // before the trace() function for ckecking in the output panel.

here is my code:

```auto

//XML BANK
var x:XML = new XML();
x.ignoreWhite = true;

var thumb:Array = new Array();//create array
var Spc = 0;// space between thumbnail default 0
var posX = 163;// position x
var posY = 10;//1st position y

x.onLoad = function(xml) {
    var photos:Array = this.firstChild.childNodes;
    for (i=0; i<photos.length; i++) {
        var Num = i+1;
        var WhoIsOn = Num;
        var Bt_name = "Bt"+Num;
        thumb.push(photos*.attributes.thumbnail);//put each attributs of thumbnail for each photos node 

        //for the thumbnails
        var Clp_name = "clip"+Num;
        
        //i think my probleme start here:---> with container and BT:
        
        var container = (container+Num);
        var container:MovieClip = this.createEmptyMovieClip(Clp_name, this.getNextHighestDepth());
        container.loadMovie(thumb*,1);
        container._x = posX;
        container._y = posY+Spc;
        Spc = Spc+120;// increment the space between thumbnail
        
        //for the OnRelease function on the thumbnail
        var BT:MovieClip = this.attachMovie("Btb", Bt_name, this.getNextHighestDepth());
        BT._x = posX;
        BT._y = posY+Spc;
        BT.whoIsOn = i;
        BT.onRelease = function() {
            trace(this.whoIsOn);
        };//<---- end of probleme
    
    // I USE TRACE() FOR CHECK:
        //trace(photos.length); for chek the length of the for loop 
        //trace(Clp_name);// for check clip name
        //trace(thumb*);//for check file name
        //trace(container);//for chek if container is not empty should say: _level0.Clp_name in the output but it dont
        //trace(thumb);//for check array
        //trace(BT);//same probleme as container
        //trace(Bt_name);//for check button name
        //trace(Spc);// for check the positio _Y
    }
};
x.load("TumbLoader.xml");

```
