Comunidad de diseño web y desarrollo en internet online

variables y xml

Citar            
MensajeEscrito el 01 Nov 2007 11:00 pm
buenas gente tengo un problema, cuando abro un xml quiero guardar la informacion en una variable para despues poder utilizarla, pero no puedo aca esta el codigo

Código :

tema = new Sound();
tema_xml = new XML();
tema_xml.ignoreWhite = true;
tema_xml.onLoad = funcion(exito)
{
   ruta = tema_xml.firstChild.childNodes[0].childNodes[0].firstChild;
}
tema_xml.load("lista.xml");

tema.loadSound(ruta,true);

y me tira este error:
Error opening URL "file:///C|/Documents%20and%20Settings/Totote/Escritorio/fauno/undefined"

como puedo hacer para guardar ese dato en la variable :S. Saludos

Por totote

18 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 05 Nov 2007 05:49 am
te recomiendo que hagas estos cambios en tu as y fijate donde te comente el codigo que suceda eso.

Código :

var tema:Sound = new Sound();
var ruta:String = "";
var tema_xml:XML = new XML();
tema_xml.ignoreWhite = true;
tema_xml.onLoad = function(ok) {
   if (ok) {
      ruta = this.firstChild.childNodes[0].childNodes[0].firstChild;
      //comprueba que la avriable ruta traiga el nombre del file mp3 a cargar
      //y no te olvides de controlar la ruta del mismo
      trace(ruta);
   } else {
      //comprueba que se cargue el xml correctamente
      trace("no se cargo el xml");
   }
};
tema_xml.load("lista.xml");
tema.loadSound(ruta,true);

Por leobaraldi

351 de clabLevel

3 tutoriales

 

firefox
Citar            
MensajeEscrito el 05 Nov 2007 05:02 pm
bueno tema resuelto el problema es que carga bien las cosas pero todavia no comprendo bien como maneja las funciones y variables el ActionScript, pero el problema es que una vez que salio de la funcion las variables no tienen mas el valor que se les habia cargado, aca esta la solucion q encontre

Código :

tema = new Sound();
tema_xml = new XML();
tema_xml.ignoreWhite = true;
tema_xml.onLoad = funcion(exito)
{   
     ruta = tema_xml.firstChild.childNodes[0].childNodes[0].firstChild;
     // tengo que cargar el sonido aca, sino fuera de la funcion
     // ruta pierde su valor
     tema.loadSound(ruta,true);
}
tema_xml.load("lista.xml");

Por totote

18 de clabLevel



Genero:Masculino  

msie

 

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