Catalogo en flash con attachMovie
Publicado por Martin (1 intervención) el 07/11/2006 21:27:54
Se trata de un catalogo de productos donde los elementos estan siendo llamados desde un archivo xml: sandwiches.xml
el problema es q estoy tratando de mostrar un imagen por cada producto dentro de un movieclip, cada ruta de imagen esta dentro del arreglo image[], pero me devuelve para todas el ultimo de ellos, alguien me podria dar la solucion, q es lo q esta mal aqui.
bueno aca les mando el código a ver si alguien lo puede comprender y ayudarme:
aqui_posx = -4.300000E+000;
aqui_posy = 3.040000E+001;
var obj_xml:XML = new XML();
obj_xml.ignoreWhite = true;
obj_xml.load("sandwiches.xml");
obj_xml.onLoad = function(exito) {
if (exito) {
trace(obj_xml.firstChild.childNodes.length)
image = [];
var I:Number = 0;
contenido.pantalla_mc._visible=false;
for (I = 0; I <= (obj_xml.firstChild.childNodes.length - 1); I++)
{
contenido.attachMovie("agen_00","agen_" + I, I);
contenido["agen_" + I]._x = aqui_posx;
contenido["agen_" + I]._y = aqui_posy;
aqui_posy = aqui_posy + contenido["agen_" + I]._height;
contenido["agen_" + I].txt_actividad.text = obj_xml.firstChild.childNodes[I].childNodes[2].firstChild.nodeValue;
contenido["agen_" +I].txt_dias.text = obj_xml.firstChild.childNodes[I].childNodes[1].firstChild.nodeValue;
image[I] = obj_xml.firstChild.childNodes[I].childNodes[0].firstChild.nodeValue;
//contenido["agen_" +I].txt_imagen.text = obj_xml.firstChild.childNodes[I].childNodes[0].firstChild.nodeValue;
//EVENTO ONRELEASE
//contenido.pantalla_mc.loadMovie(image[0]);
var img:String = obj_xml.firstChild.childNodes[I].childNodes[0].firstChild.nodeValue;
contenido["agen_" +I].botoncito.botoncito2.onRelease = function() {
contenido.pantalla_mc.loadMovie(img,1); // --> ACA ESTA EL PROBLEMA
}
}
} else {
cuerpo_txt.text = "Error";
}
};
el problema es q estoy tratando de mostrar un imagen por cada producto dentro de un movieclip, cada ruta de imagen esta dentro del arreglo image[], pero me devuelve para todas el ultimo de ellos, alguien me podria dar la solucion, q es lo q esta mal aqui.
bueno aca les mando el código a ver si alguien lo puede comprender y ayudarme:
aqui_posx = -4.300000E+000;
aqui_posy = 3.040000E+001;
var obj_xml:XML = new XML();
obj_xml.ignoreWhite = true;
obj_xml.load("sandwiches.xml");
obj_xml.onLoad = function(exito) {
if (exito) {
trace(obj_xml.firstChild.childNodes.length)
image = [];
var I:Number = 0;
contenido.pantalla_mc._visible=false;
for (I = 0; I <= (obj_xml.firstChild.childNodes.length - 1); I++)
{
contenido.attachMovie("agen_00","agen_" + I, I);
contenido["agen_" + I]._x = aqui_posx;
contenido["agen_" + I]._y = aqui_posy;
aqui_posy = aqui_posy + contenido["agen_" + I]._height;
contenido["agen_" + I].txt_actividad.text = obj_xml.firstChild.childNodes[I].childNodes[2].firstChild.nodeValue;
contenido["agen_" +I].txt_dias.text = obj_xml.firstChild.childNodes[I].childNodes[1].firstChild.nodeValue;
image[I] = obj_xml.firstChild.childNodes[I].childNodes[0].firstChild.nodeValue;
//contenido["agen_" +I].txt_imagen.text = obj_xml.firstChild.childNodes[I].childNodes[0].firstChild.nodeValue;
//EVENTO ONRELEASE
//contenido.pantalla_mc.loadMovie(image[0]);
var img:String = obj_xml.firstChild.childNodes[I].childNodes[0].firstChild.nodeValue;
contenido["agen_" +I].botoncito.botoncito2.onRelease = function() {
contenido.pantalla_mc.loadMovie(img,1); // --> ACA ESTA EL PROBLEMA
}
}
} else {
cuerpo_txt.text = "Error";
}
};
Valora esta pregunta
0