Comunidad de diseño web y desarrollo en internet online

problema al cargar un xml

Citar            
MensajeEscrito el 18 Mar 2009 09:13 am
Hola a todos/as,

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 :cry: !!!

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.

Por jmanaut

13 de clabLevel



 

firefox
Citar            
MensajeEscrito el 18 Mar 2009 12:06 pm
Estás haciendo un attachMovie del clip txtNoticia .. ¿existe ese clip en tu biblioteca? Si no existe, cópiatelo de la librería del otro fla de donde te copiaste el código

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 19 Mar 2009 08:39 am
Hola,

Si que existe el txtnoticias, estoy loco, ya no ser que hacer :cry: :cry:

jordi

Por jmanaut

13 de clabLevel



 

firefox
Citar            
MensajeEscrito el 19 Mar 2009 10:25 am
Traza a ver si se crean

Código ActionScript :

for(i=0;i<contingut.length;i++){
    campo = attachMovie("txtNoticia", "txtInsertat"+i,i);
    campo.titol = contingut[i][0];
    trace(campo+":"+campo.titol)
    ....


¿El clip txtNoticia tiene asignada la variable titol al campo de texto?

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 19 Mar 2009 10:43 am
perdonad, soy un poco tonto, un poco no mucho.

en txtNoticia tenia codigo forzando el contenido de los campos y por seo no me funcionava.

perdon,

jordi

Por jmanaut

13 de clabLevel



 

firefox

 

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