Hola.
Primero que nada un saludo a todos los listeros , este es mi primer mensaje y espero
me puedan ayudar.
Estoy aprendiendo sobre el xml , arrays y flash y tengo algunas dudas...
Problema:
Tengo un menu, el cual toma de un xml externo los nombres de los botones y tambien los
textos que carga cada uno de los botones.
El xml externo es de este estilo:
<botones>
<boton nombre="boton1">Este es el texto que carga el boton N�1. </boton>
<boton nombre="boton2">Este es el texto que carga el boton N�2. </boton>
<boton nombre="boton3">Este es el texto que carga el boton N�3. </boton>
</botones>
// En el fotograma 1 de la pelicula cargo el xml:
mixml = new XML();
mixml.load("xmlexterno.xml");
// En el fotograma 5 tengo tres botones cada uno con un campo de texto din�mico en
donde cargara el nombre del mismo (bot1, bot2,bot3), tambien tengo un cuadro de texto
din�mico (llamado texto) en donde cargaran los textos que mande cada boton.
// El codigo que pongo en el fotograma 5 es:
totalbot = new Array();
nombres = new Array();
nombres = mixml.firstChild.childNodes;
for (i in nombres) {
if (nombres[i].nodeName == "boton") {
textbot = new Array();
textbot[0] = nombres[i].firstChild.nodeValue;
textbot[1] = nombres[i].attributes.nombre;
}
totalbot.push(textbot);
}
//el problema esta en que el array totlabot me queda mal formado, y he tenido que
tantear para poder asignar a cada boton el nombre y texto que cargara..
bot1 = totalbot[6][1];
bot2 = totalbot[4][1];
bot3 = totalbot[2][1];
stop();
//El codigo en los botones es:
//boton1:
on (release) {
clip.texto = totalbot[6][0];
}
//boton2:
on (release) {
clip.texto = totalbot[4][0];
}
//boton3:
on (release) {
clip.texto = totalbot[2][0];
}
Les dejo todo el codigo para que lo analizen y me digan que hago mal, o que se puede
mejorar.
saludos y gracias
<!-------------------------------
Lista ASNativos:
subscripciones/desubscripciones
http://www.sidedev.net/asnativos
-------------------------------->