Comunidad de diseño web y desarrollo en internet online

Problema con push a array xml

Citar            
MensajeEscrito el 07 Sep 2009 12:22 am
Hola!

lo qu pasa es que me ha pasado algo inusual....antes me servia ese código :( pero no se que paso

en el stage, hay un text field con instancia captions, y un mc con instancia holder, y este es el código:

Código ActionScript :

var x:XML = new XML();
x.ignoreWhite = true;

var urls:Array = new Array();
var captions:Array = new Array();
x.onLoad = function(success) {
   var photos:Array = this.firstChild.childNodes;
   for(i=0;i<photos.length;i++) {
      urls.push(photos[i].attributes.foto);
      captions.push(photos[i].attributes.nombre);
      var spacer:Number = 50;
      var newY:Number = i * (holder._height + spacer);
      holder.duplicateMovieClip("holder" + i, i, {_y:newY});
      loadMovie(urls[i], "holder" + i);
      caption.text = captions[i];
         }
      }   

x.load("lost.xml");


la gracia es que me muestre la información de este xml:

Código XML :

<?xml version="1.0" encoding="ISO-8859-1"?>
<index>
<trabajo nombre="Andes" foto="lost1.jpg"/>
<trabajo nombre="Av. Boyacá" foto="lost2.jpg"/>
<trabajo nombre="Andes" foto="lost3.jpg"/>
<trabajo nombre="Av. Boyacá" foto="lost4.jpg"/>
</index>


pero solo me muestra uno :shock: :shock: el primero me podrian ayudar :P

Gracias!

Por sforero

478 de clabLevel

1 tutorial

 

social media expert world

chrome
Citar            
MensajeEscrito el 08 Sep 2009 10:04 pm
yo cambiaria var photos:Array = this.firstChild.childNodes;
for(i=0;i<photos.length;i++) {

por
var photos = this.firstChild.childNodes.length
for(i=0;i<photos;i++) {

y dsp calculo que el text box tendria que ir dentro del movie holder
y ahi si cambiaria esta linea
caption.text = captions[i];
por esta
this["holder"+i].caption.text = captions[i];


espero que te sirva ;)

Por da_vidricota

20 de clabLevel



 

firefox
Citar            
MensajeEscrito el 09 Sep 2009 12:53 am
no creo que eso ya lo solucione pero gracias..!

Por sforero

478 de clabLevel

1 tutorial

 

social media expert world

chrome

 

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