Hello everyone,
I have this code and I want that when you click on each thumbnail returns its id (associated with i) but only get to return the id of the last image, any idea why this happens and how I fix it?
Thanks in advance.(sorry for my english)
x = 40;
y = 200;
//--------------------------
_global.ancho = 238; //Ancho imagen
_global.alto = 159;
//--------------------------
contenedor_mc._x = 0;
contenedor_mc._y = 0;
//----------------------------
System.useCodepage = true;
_global.datos = new XML();
datos.ignoreWhite = true;
datos.onLoad = function() {
for (var i = 0; i<datos.firstChild.childNodes.length; i++) {
_root.cont = datos.firstChild.childNodes.length;
ruta = datos.firstChild.childNodes*.attributes.archivo;
//ids = datos.childNodes[0].childNodes*.attributes.id;
//trace(ruta);
var imagen:MovieClip = contenedor_mc.createEmptyMovieClip("imagen"+i, i+1000);
contenedor_mc.id = i;
imagen._x = x;
imagen._y = y;
imagen.loadMovie(ruta);
x += ancho;
// Control de nĂºmero de columnas
if (x >= ancho*4) {
x = 40;
y += alto;
}
}
// Btn que deberia devolverme el id de cada imagen en concreto
contenedor_mc.onPress= function(){
_global.a =(this.id);
gotoAndStop(2);
trace(a);
}
};
datos.load("xml/imagenesIndex.xml");
Bye, agroM