Comunidad de diseño web y desarrollo en internet online

Imprimir todo el array

Citar            
MensajeEscrito el 17 Feb 2009 05:24 am
hola amigos tengo una duda estoy llenando un campo de texto con datos extraidos de un xml
pero a la hora de llenar el texto no se como imprimir todos los valores del xml :oops: sin hacer tanto relajo como el que tengo.
este es mi codigo

Código :

var theXML:XML = new XML();
theXML.ignoreWhite = true;
area.wordWrap=true;
theXML.onLoad = function() {
   var nodes = this.firstChild.childNodes;
   for(i=0;i<nodes.length;i++) {
      area.text=theXML.firstChild.childNodes[0].firstChild.nodeValue+"\n"+
      theXML.firstChild.childNodes[1].firstChild.nodeValue+"\n"+
      theXML.firstChild.childNodes[2].firstChild.nodeValue+"\n";
   }
}

theXML.load("http://localhost:8080/flash/products.php");

gracias de antemano por su ayuda

Por pandro

Invitado



 

firefox
Citar            
MensajeEscrito el 17 Feb 2009 06:30 am
hola, haces un for pero no usas tu variable i, asi estaria mejor:

Código ActionScript :

var theXML:XML = new XML();
theXML.ignoreWhite = true;
area.wordWrap=true;
theXML.onLoad = function( ok:Boolean ) {
   if( ok ){
      var nodes = this.firstChild.childNodes;
      area.text = "";
      for( var i:Number = 0; i < nodes.length; i++) area.text += nodes[i].firstChild.nodeValue + "\n";
   } else area.text = "error...";
}
theXML.load("http://localhost:8080/flash/products.php");


o

Código ActionScript :

var theXML:XML = new XML(); 
theXML.ignoreWhite = true; 
area.wordWrap = true; 
theXML.onLoad = function( ok:Boolean ) { 
      for( var i:Number = 0; i < this.firstChild.childNodes.length; i++) 
            area.text += this.firstChild.childNodes[i].firstChild.nodeValue + "\n"; 
}; 
theXML.load("http://localhost:8080/flash/products.php"); 

Suerte.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 17 Feb 2009 06:36 am
:D Gracias LongVie ya lo implemente y funciono ^^ muchisimas gracias a hora solo me falta darle un efecto de scroll automatico :wink:

Por pandro

Invitado



 

firefox

 

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