Comunidad de diseño web y desarrollo en internet online

XML

Citar            
MensajeEscrito el 12 May 2005 12:59 pm
HOla les querria hacer una pregunta sobre xml, son mis primeros pasas y e me e leido el tuto q hay en la pagina sobre xml.

Miren me pasa esto:

Tengo un titulos.xml:

<titulo>
<Nombre>Quien soy?</Nombre>
<Apellido>Tu Apellido</Apellido>
<Nombre>Quien soy?2</Nombre>
<Apellido>Tu Apellido2</Apellido>
<Nombre>Quien soy?3</Nombre>
<Apellido>Tu Apellido3</Apellido>
<Nombre>Quien soy?4</Nombre>
<Apellido>Tu Apellido4</Apellido>
<Nombre>Quien soy?5</Nombre>
<Apellido>Tu Apellido6</Apellido>

</titulo>

Les e copiado la esctructura para q vean q seran mucho titulos lo q se cargara, bien esto por una parte depues tengo el .fla Con el siguiente as en el primer keyFrame :

var obj_xml:XML = new XML();
obj_xml.ignoreWhite = true;
obj_xml.onLoad = function(exito) {
if (exito) {
Nombre.text = obj_xml.firstChild.childNodes[0].firstChild.nodeValue;

} else {
Nombre.text = "Error";
}
};
function cargarXML() {
obj_xml.load("texto.xml");
}
cargarXML();

Bien con esto carga perfectamnte el primer nodo es decir cargara Quien soy?Lo q me gustaria hacer es q en Nombre.txt me cargara el nodo q yo quiera dependiendo al boton q escojan. Como se podria hacer?? con xml?? se me ocurren 2 formas mas de hacerlo sin xml (mucho mas sencillas) q seria crear un array en flash con los campos y listos o bien crear un clip de pelicula q dentro de el esten todos los titulos q quiera y haciendo un nextFrame lo tendria, pero me gustaria saber hacer con xml, a ver si me pueden ayudar.Gracias

Por carter15

73 de clabLevel



 

firefox
Citar            
MensajeEscrito el 12 May 2005 02:02 pm
Nombre.text = obj_xml.firstChild.childNodes[0].firstChild.nodeValue;

Si ese 0 lo cambias por 1 te saldria ; Tu Apellido
Si lo cambias por 2 Quien soy?2 y asi consecutivamente

Por _CONEJO

BOFH

7639 de clabLevel

17 tutoriales
21 articulos

 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.