soy nuevo en todo esto de flash, xml, etc..
estoy haciendo una pàgina que busca en un xml y carga tantas noticias como haya en el xml.
El problema: por el "trace" me muestra bien los resultados pero no me los imprime
este es el XML:
Código :
<?xml version="1.0" encoding="iso-8859-1"?> <conteningutXML> <noticia> <titlo>n1</titlo> <des>n1</des> </noticia> <noticia> <titlo>n2</titlo> <des>n2</des> </noticia> <noticia> <titlo>n3</titlo> <des>n3</des> </noticia> </conteningutXML>
este es el fla que carga el xml:
Código :
var oxml:XML = new XML();
oxml.ignoreWhite = true;
oxml.onLoad = function() {
var rootNode = xmlDoc.firstChild;
trace("Número de cotinguts: "+ oxml.firstChild.childNodes.length);
for(i=0;i<oxml.firstChild.childNodes.length;i++)
{
contingut[i] = new Array(2);
contingut[i][0] = oxml.firstChild.childNodes[i].childNodes[0].childNodes[0].nodeValue;
contingut[i][1] = oxml.firstChild.childNodes[i].childNodes[1].childNodes[0].nodeValue;
trace("Contingut: "+ contingut[i][0] + " - "+ contingut[i][1]);
}
play();
};
/////////////////////// XML CARREGAT //////////////////////
contingut = new Array();
System.useCodepage = true; //Per Pillar Accents
//oxml.load("/xml/noticies.xml"); // == Online
oxml.load("http://localhost:8080/intrusa/xml/noticies.xml"); // == Offline
stop();
y ahora ya para acabar este es el AS que imprime los resultados:
Código :
posX = 75;
posY = 0;
altura = 0; //Per fer l'scroll
for(i=0;i<contingut.length;i++){
attachMovie("txtNoticia", "txtInsertat"+i,i);
objecte = this["txtInsertat"+i];
objecte.titol = contingut[i][0];
objecte.des = contingut[i][1];
altura += objecte._height + 10;
objecte._x = posX;
objecte._y = posY;
posY+=objecte._height + 5;
}
stop();
este es un codigo que funcion en otro pagina, no ser si me he olvidado alguna cosa o que...
estoy echo un lioooo
Muchas gracias a todos/as.
