Comunidad de diseño web y desarrollo en internet online

cargar con action script un archivo XML

Citar            
MensajeEscrito el 14 May 2007 07:36 pm
necesito ayuda.....
soy nueva en esto del action script y necesito hacer una pagina de internet que sea cargada desde el action script pero que este atraiga a los archivos desde un XML y no se como hacerlo..
lo que llevo hasta el moemnto es esto pero no se si realmente este bueno..
System.useCodepage = true;
var mi_xml = new XML();
mi_xml.ignoreWhite = true;
// borra los espacios...para que sea seguido
mi_xml.onLoad = function(ok) {
if (ok) {
crear_bots(this);
} else {
trace("error al cargar xml");
}
};
mi_xml.load("laberinto.xml");
var crear_bots = function (xml) {
var secciones = xml.firstChild.childNodes;
for (i=0; i<secciones.length; i++) {
var sec = this.attachMovie("imagenes", "sec"+i, this.getNextHighestDepth());
sec._x = i*(sec._width+10)+100;
sec._y = 50;
sec.txt.text = secciones[i].attributes.nombre;
var vacio = this.createEmptyMovieClip("v"+i, this.getNextHighestDepth());
vacio._x = sec._x;
vacio._y = sec._height+10+sec._y;
var vinculos=secciones[i].childNodes;
for(j=0;j<vinculos.length; j++){
var vinc=vacio.attachMovie("imagenes", "vin"+j,vacio.getNextHighestDepth());
//para la posicion//
vinc._y= (vinc._height+10)*j;
//para que ponga todos en el eje y//
vinc.txt.text=vinculos[j].attributes.nombre;
var accion=vinculos[j].attributes.tipo;
if(accion=="lm"){
vinc.btn.onRelease=function(){
cargar_img(this.acciones);
}
}else if(accion=="video"){
vinc.btn.onRelease=function(){
cargar_video(this.acciones);
}
}
vinc.btn.acciones=vinculos[j];
}

sec.btn.onRelease=function(){
mostrar(this.vacio);
}
sec.btn.vacio=vacio;
vacio._visible=false;

}
};
var mostrar=function(cual){
for(i=0;i<cant;i++){
eval("v"+i)._visible=false;
}
cual._visible=true;
}
var cargar_img=function (datos){
t_txt.text=datos.attributes.nombre;
d_txt.htmlText=datos.firstChild;
d_txt.htmlText=d_txt.text;
d_txt.scroll=1;
img_mc.loadMovie(datos.attributes.link);
}

tambien en el mismo movie clip en el que tengo cargando las imagenes tengo que hacer que cargue videos pero qeu cuando los cargue borre la imagen que esta ahi en el movie clip
y asi sucesivamente.
muchas gracias si me colaboran lo mas pronto posible .
les deberia el alma y una buena nota

Por carol101

2 de clabLevel



Genero:Femenino  

msie7
Citar            
MensajeEscrito el 15 May 2007 01:34 pm
mhh..a ver no me queda muy claro lo que quieres hacer.. que tipo de archivos quieres cargar?.. archivos de imagen u otros SWF?, por que independientemente de lo que quieras hacer primero lo mas recomedable es que vayas imprimiendo lo que vayas obteniendo del XML para asegurarte de que estas extrayendo correctamente los valores (con un trace) de cada una de las cadenas que obtengas, y pues si puedes especificar un poco mas que es lo que quieres cargar estaría muy bien.

Y pues lo de los videos.. pues nunca lo hecho, pero nunca es tarde para empezar :lol:

Saludos.

Por zelgadiss01

87 de clabLevel



 

The Silent Hills

msie

 

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