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

Ayuda con texto dinamico¡¡¡¡¡

Estas en el tema de Ayuda con texto dinamico¡¡¡¡¡ en el foro de Flash y Actionscript en Foros del Web. El asunto es el siguiente tengo un xml con la informacion que se va a cargar en un swf, este es el xml: <rss version="2.0"> ...
  #1 (permalink)  
Antiguo 22/05/2008, 13:49
Avatar de emilianocepa  
Fecha de Ingreso: mayo-2007
Mensajes: 45
Antigüedad: 17 años
Puntos: 2
Ayuda con texto dinamico¡¡¡¡¡

El asunto es el siguiente tengo un xml con la informacion que se va a cargar en un swf,


este es el xml:


<rss version="2.0">
<channel>
<item>
<titulo>Noticia 1</titulo>
<descripcion>Breve descripcion</descripcion>
<contenido>Esto es lo que sucedio solo fue lo que fue</contenido>
</item>


la cosa es que el contenido se carga en un texto dinamico,pero se repite muchas veces en ves de mostrarlo una sola vez.

este es el script del flash:

var rssurl:String = "noticias.xml";
var anot:Array = new Array();
var rssxml:XML = new XML();
anot = [];
rssxml.ignoreWhite = true;
rssxml.load(rssurl);
rssxml.onLoad = function() {
var nodo:XMLNode = rssxml.firstChild.firstChild;

for (i=0; i<nodo.childNodes.length; i++) {
var snodo:XMLNode = nodo.childNodes[i];
switch (snodo.nodeName) {
case "item":
getContent(snodo);
break;
}
}
for (j=0;j<anot.length;j++) {
//Creais las cajas de texto dinamicamente y lo vais cargando
//Titulo = anot[j][0]
//Descripcion = anot[j][1]
//Contenido = anot[j][2]
//La linea de abajo la podeis quitar es pa que veais q funciona
txtcontent.htmlText = txtcontent.htmlText + anot[0][0];
txtcontent2.htmlText = txtcontent2.htmlText + anot[0][1];
txtcontent3.htmlText = txtcontent3.htmlText + anot[0][2];
txtcontent1.htmlText = txtcontent1.htmlText + anot[1][0];
}
}

function getContent(vxml) {
var stit:String = "";
var surl:String = "";
var sdes:String = "";
var svar:Array = new Array();
for (j=0; j<vxml.childNodes.length; j++) {
var sxml:XMLNode = vxml.childNodes[j];
switch (sxml.nodeName) {
case "titulo":
vtit = sxml.firstChild.nodeValue;
break;
case "descripcion":
vdes = sxml.firstChild.nodeValue;
break;
case "contenido":
vcont = sxml.firstChild.nodeValue;
break;
}
}
svar[0] = vtit;
svar[1] = vdes;
svar[2] = vcont;
anot[anot.length] = svar;
}


si al guien me puede ayudar; graciass
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 20:15.