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

no me lee el xml

Estas en el tema de no me lee el xml en el foro de Flash y Actionscript en Foros del Web. Hola amigos, tengo un pequeño problema, estoy haciendo un buscador en flash y xml, y cuando pongo todo los componentes en el escenario me funciona, ...
  #1 (permalink)  
Antiguo 29/08/2008, 10:58
Avatar de oppjpp  
Fecha de Ingreso: octubre-2007
Mensajes: 304
Antigüedad: 16 años, 6 meses
Puntos: 2
no me lee el xml

Hola amigos, tengo un pequeño problema, estoy haciendo un buscador en flash y xml, y cuando pongo todo los componentes en el escenario me funciona, el problema se me presenta cuando quiero englobarlo en un MC, no me lee el contenido del xml, les adjunto el codigo a ver si algo esta mal:

Cita:
search_mc._visible = false;
searching._visible = false;
no_found._visible = false;

function load_xml() {
searching._visible = false;
no_found._visible = false;
//
System.useCodepage = true;
sXML = new XML();
sXML.ignoreWhite = true;
sXML.load("search.xml");
sXML.onLoad = function(ok) {
if (ok) {
search();
}
};
}

function search() {
//
found = 0;
total = sXML.firstChild.firstChild.childNodes.length;
s=0;
//
searching._visible = false;
//
for (i=0; i<total; i++) {
//removeMovieClip(_root["mc"+i]);
}
for (i=0; i<total; i++) {
//
search_place = sXML.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue.toString();
//search_place2 = sXML.firstChild.childNodes[i].childNodes[1].firstChild.nodeValue.toString();
//
if (search_place.toLowerCase().indexOf(search_text.te xt.toLowerCase())>-1 || search_place2.toLowerCase().indexOf(search_text.te xt.toLowerCase())>-1) {
found = 1;
search_mc.duplicateMovieClip("mc"+i, i);
search_mc._visible = false;
_root["mc"+i]._y = ((s)*(search_mc._height+10)) + (search_mc._y);
s++;
_root["mc"+i].title = sXML.firstChild.childNodes[i].childNodes[0].firstChild;
_root["mc"+i].description = sXML.firstChild.childNodes[i].childNodes[1].firstChild;

//---------------------------------------------------------------------------------------
}
}
if (found == 0) {
no_found._visible = true;
}
}
un saludo y gracias
  #2 (permalink)  
Antiguo 29/08/2008, 11:01
Avatar de Lynxcraft  
Fecha de Ingreso: noviembre-2007
Ubicación: yecla murcia
Mensajes: 1.346
Antigüedad: 16 años, 5 meses
Puntos: 51
Respuesta: no me lee el xml

si quieres meterlo en un solo mc tienes que quitar el _root y poner this
__________________
Sobran las ideas cuando faltan ganas de trabajar en ellas
Lynxcraft
  #3 (permalink)  
Antiguo 29/08/2008, 11:34
Avatar de oppjpp  
Fecha de Ingreso: octubre-2007
Mensajes: 304
Antigüedad: 16 años, 6 meses
Puntos: 2
Respuesta: no me lee el xml

Gracias amigo ya me funciona, un saludo y mil gracais
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 15:05.