Yo por ejemplo, tengo este XML:
Código :
<novedades> <noticia> <titulo>Testnoticia 1</titulo> <texto>El martes..</texto> </noticia> <noticia> <titulo>Testnoticia 2</titulo> <texto>el miercoles</texto> </noticia> <noticia> <titulo>Testnoticia 3</titulo> <texto>el jueves..</texto> </noticia> <noticia> <titulo>Testnoticia 4</titulo> <texto>el viernes..</texto> </noticia> <noticia> <titulo>Testnoticia 5</titulo <texto>el sabado...</texto> </noticia> </novedades>
Y este AS3 para cargarlo...
Código :
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, showXML);
xmlLoader.load(new URLRequest("caca.xml"));
function showXML(e:Event):void {
XML.ignoreWhitespace = true;
var news:XML = new XML(e.target.data);
trace("cantidad de etiquitas: " + news.noticia.length());
total.text = "Total de etiquetas: " + news.noticia.length();
var i:Number;
for (i=0; i < news.noticia.length(); i++) {
//trace(" Name of the song: "+ songs.track[i].title.text());
//trace(" Name of the Band: "+ songs.track[i].band.text());
titulo.text = news.noticia[i].texto.text();
trace("Novedad: "+ news.noticia[i].texto.text());
}
}El problema, es que por ejemplo.. al hacer un trace de news.noticia[i].texto.text(), salen barbaro los 5 textos.. pero si los muestro en un txt dinamico.. me muestra el ultimo, y asi con otros intentos....
Pero yo lo que quiero, es un visualizador de noticias... al hacer click en el boton "XSig" cargue el siguiente nodo "noticia"... y asi sucesivamente.. hasta que se acaben los nodos.. luego los nodos "titulo" y "texto" serian cargados en txt dinamicos al stage.
Quiero, que por favor, me digan si me malexplico... ps.. es algo que me esta comiendo tiempo que no tengo
Gracias
