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

Consultas xml sin repetir datos

Estas en el tema de Consultas xml sin repetir datos en el foro de Flash y Actionscript en Foros del Web. Hola, resulta q tengo un sitio en el cual se pueden realizar consultas de autores de articulos de revista, estos autores y los respectivos titulos ...
  #1 (permalink)  
Antiguo 06/08/2009, 10:44
 
Fecha de Ingreso: marzo-2004
Mensajes: 199
Antigüedad: 20 años, 1 mes
Puntos: 1
Consultas xml sin repetir datos

Hola, resulta q tengo un sitio en el cual se pueden realizar consultas de autores de articulos de revista, estos autores y los respectivos titulos de los articulos estan en un archivo XML, para q hay autores que han escrito varios articulos, entonces cuando le digo q me liste los autores me repite aquellos q tienen varios articulos, como hacer para q me liste solo un autor y todos sus artículos?
Este es el codigo q tengo actualmente


xmlAutores = new XML();
xmlAutores.ignoreWhite = true;
xmlAutores.onLoad = function(success) {
if (success) {
trace(xmlAutores.firstChild.childNodes.length);

largo = xmlAutores.firstChild.childNodes.length;
autor = new Array(largo);
fecha = new Array(largo);
valor = new Array(largo);
titulo = new Array(largo);
archivo = new Array(largo);
edicion = new Array(largo);

for (i=0; i<largo; i++) {

autor[i] = xmlAutores.firstChild.childNodes[i].childNodes[0].firstChild;
fecha[i] = xmlAutores.firstChild.childNodes[i].childNodes[1].firstChild;
titulo[i] = xmlAutores.firstChild.childNodes[i].childNodes[2].firstChild;
archivo[i] = xmlAutores.firstChild.childNodes[i].childNodes[4].firstChild;
edicion[i] = xmlAutores.firstChild.childNodes[i].childNodes[3].firstChild;
valor[i] = i;
}
llenarCombo();
}
else {
trace("No se pudo cargar el XML");
}
};
xmlAutores.load("base3.xml");

function llenarCombo() {

losDatos = new Array();
miDesplegable.dataProvider = losDatos;


for (i=0; i<autor.length; i++)
{
trace(miDesplegable);
if(i>0)
{
if(autor[i].toString() != autor[i-1].toString())
{
losDatos.addItem({label:autor[i], data:valor[i]});

}
}
else
{
losDatos.addItem({label:autor[i], data:valor[i]});

}
}
}

var myListener:Object = new Object();
miDesplegable.addEventListener("change",myListener );
myListener.change = function(event){


buscarObras(event.target.selectedItem.label)
}


function buscarObras(autorSel)
{
lasObras = new Array();
obras.dataProvider = lasObras;
for(i=0; i<autor.length; i++)
{
if(autor[i].toString() == autorSel.toString()){
lasObras.addItem({label:fecha[i], data:archivo[i]});
lasObras.addItem({label:titulo[i], data:archivo[i]});
lasObras.addItem({label:edicion[i], data:archivo[i]});
lasObras.addItem({trace:'___'});
}

}
}


var myListenerObra:Object = new Object();
obras.addEventListener("change",myListenerObra);
myListenerObra.change = function(event){


abrirArchivo(event.target.selectedItem.data)
}

function abrirArchivo(nombreArchivo)
{
getURL("swf/" + nombreArchivo,_blank);

}


function buscarObrasTexto(autorSel)
{
lasObras = new Array();
miDesplegable.dataProvider = lasObras;
for(i=0; i<autor.length; i++)
{
if(autor[i].toString().toLowerCase().indexOf(autorSel.toLower Case()) >= 0){
lasObras.addItem({label:autor[i], data:valor[i]});
}

}
}
stop();


GRACIAS
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 02:47.