Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/12/2009, 12:04
Operadormail
 
Fecha de Ingreso: junio-2003
Mensajes: 778
Antigüedad: 20 años, 10 meses
Puntos: 1
XML array y AS

Hola a todos

Llevo un par de días buscando solución a este problema pero no encuentro nada (no tengo mucha idea de AC)

Tengo el siguiente documento XML:

Código:
<?xml version="1.0" encoding="UTF-8"?>
<news>
<item id="1">
<title>titulo noticia</title>
<file>archivo.zip</file>
<url>URL del archivo</url>
</item>
<item id="2">
<title>titulo noticia 2</title>
<file>archivo2.zip</file>
<url>URL del archivo2</url>
</item>
</news>
Y el siguiente código AC

Código:
this.createTextField("my_txt", 0, 0, 0, 340, 120);
my_txt.html = true;
my_txt.autoSize = "left";
my_txt.border = false;
my_txt.multiline = true;
my_txt.wordWrap = true;
my_txt.font = "Verdana"
my_txt.size = "12";
my_txt.textColor = "0xFFFFFF";


var reviews_xml:XML = new XML();
reviews_xml.ignoreWhite = true;
reviews_xml.onLoad = function (success:Boolean):Void {
    if (success) {
        var childItems:Array = reviews_xml.firstChild.childNodes;
		
        for (var i:Number = 0; i < childItems.length; i++) {           			
			//my_txt.text += childItems[i].firstChild.firstChild.nodeValue + "\n";
			if(childItems[i].firstChild.nodeValue[2].firstChild.nodeValue!="") {
			my_txt.text += "<a href='"+childItems[i].firstChild.nodeValue[2].firstChild.nodeValue+"'>"+childItems[i].firstChild.firstChild.nodeValue+ "</a> \n";
			}
			else {
			my_txt.text += childItems[i].firstChild.firstChild.nodeValue + "\n";	
			}
			 
        }
    } else {
        my_txt.text = "No se ha podido cargar el documento XML";
    }
}
reviews_xml.load("noticias.xml");
El problema es que no consigo mostrar los datos de XML. Alguna solución???