Foros del Web » Creando para Internet » Flash y Actionscript »

Imprime solo ultimo valor del Array. PQe?

Estas en el tema de Imprime solo ultimo valor del Array. PQe? en el foro de Flash y Actionscript en Foros del Web. Estoy trayendo 6 valores de un XML. Si les hago un trace me los imprime bien todos, pero si los meto en un campo de ...
  #1 (permalink)  
Antiguo 26/01/2008, 11:33
 
Fecha de Ingreso: enero-2002
Mensajes: 349
Antigüedad: 22 años, 3 meses
Puntos: 1
Imprime solo ultimo valor del Array. PQe?

Estoy trayendo 6 valores de un XML.

Si les hago un trace me los imprime bien todos, pero si los meto en un campo de texto dinamico solo me imprime el ultimo valor del array.

:::: CODE :::::

//load in XML
var XMLcontent:XML = new XML();
XMLcontent.ignoreWhite = true;
XMLcontent.load("test_xml.xml");

//init TextArea component
myText.html = true;
myText.wordWrap = true;
myText.multiline = true;
myText.label.condenseWhite = true;
myText.ignoreWhite = true;

//load css
myNewStyle = new TextField.StyleSheet();
myNewStyle.load("test_style.css");
myText.styleSheet = myNewStyle;

//This code is for select one of the specific node
XMLcontent.onLoad = function(success) {
if (success) {


//It define how many nodes we have.
var num:Number = XMLcontent.firstChild.childNodes.length;
trace("NUM: --- "+num);

//Print all names
var names_array:Array = new Array();
for (var i=0; i<num; i++){
var pics = XMLcontent.firstChild.childNodes[i].attributes.nombre;
myText.text = "Nombre: "+pics+ " \n";
trace("NOMBRES: "+pics);
}
}
};



::::: XML :::::

<links>
<link nombre="Main" ref="home.html"/>
<link nombre="Pictures and Videos" ref="#">
<inLink nombre="Image Gallery" ref="pictures.html"/>
<inLink nombre="Photoshop Tutorial" ref="photoTut.html"/>
</link>
<link nombre="Programming" ref="#">
<inLink nombre="XML flash tutorial" ref="xmlflash.html"/>
<inLink nombre="Flash games" ref="flashgames.html"/>
</link>
<link nombre="3D Design" ref="#">
<inLink nombre="Blender 3D" ref="blender.html"/>
<inLink nombre="3D Studio" ref="3dStudio.html"/>
<inLink nombre="Lightwave" ref="lightwave.html"/>
</link>
<link nombre="University" ref="photoTut.html"/>
<link nombre="LW Plugin" ref="tvplugin.html"/>
</links>

Gracias de antemano

Última edición por eduvivi; 26/01/2008 a las 13:29
  #2 (permalink)  
Antiguo 26/01/2008, 14:05
Avatar de TMeister
Crazy Coder
 
Fecha de Ingreso: enero-2002
Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 22 años, 3 meses
Puntos: 193
Re: Imprime solo ultimo valor del Array. PQe?

Código:
myText.text += "Nombre: "+pics+ " \n";
en lugar de

Código:
myText.text = "Nombre: "+pics+ " \n";
  #3 (permalink)  
Antiguo 28/01/2008, 06:19
 
Fecha de Ingreso: enero-2002
Mensajes: 349
Antigüedad: 22 años, 3 meses
Puntos: 1
Re: Imprime solo ultimo valor del Array. PQe?

Perfecto!!!

Muchisimas gracias TMeister

Saludos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:33.