Hi Everybody:
I am working in an XML Image gallery.
Every Image is loaded with a preloader.
My Idea is showing 7 images together loaded one after another with their preloaders until reach the seventh image, and the stop the load.
I have been working on and adapted the Kirupa’s tutorial, but I haven’t figure it out how to load an Image after another.
here is the code:
function cargarXML(cargado) {
if (cargado) {
xmlNodo = this.firstChild;
imagen = [];
descripcion = [];
total = xmlNodo.childNodes.length;
for (i=0; i<total; i++) {
imagen* = xmlNodo.childNodes*.childNodes[0].firstChild.nodeValue;
descripcion* = xmlNodo.childNodes*.childNodes[1].firstChild.nodeValue;
}
CargarPrimeraImagen();
} else {
trace("algo ha fallado");
}
}
xmlAlbum = new XML();
xmlAlbum.ignoreWhite = true;
xmlAlbum.onLoad = cargarXML;
xmlAlbum.load("imagenes.xml");
////PRELOAD///////
this.onEnterFrame = function() {
peso =contenedor_mc.getBytesTotal()
cargado = contenedor_mc.getBytesLoaded()
if (cargado != peso ) {
precarga_txt.text = Math.round(cargado*100/peso)+" % cargado";
} else {
if (contenedor_mc._alpha<100) {
contenedor_mc._alpha += 15;
}
}
};
posarray=0
////First IMAGE///////
//generamos la funcion
function CargarPrimeraImagen() {
contenedor_mc._alpha = 0;
contenedor_mc.loadMovie(imagen[0],1);
titulo_txt.text = descripcion[0];
posicion_txt.text = posarray+1+" / "+total;
}
///Next Image////////
function SiguienteImagen() {
//Si al menos queda una imagen para llegar al total
if (posarray<(total-1)) {
contenedor_mc._alpha = 0;
posarray++;
contenedor_mc.loadMovie(imagen[posarray]);
titulo_txt.text = descripcion[posarray];
posicion_txt.text = posarray+1+" / "+total;
}
}
////Previous Image//////
function AnteriorImagen() {
//Si no es la primera imagen
if (posarray>0) {
contenedor_mc._alpha = 0;
posarray--;
contenedor_mc.loadMovie(imagen[posarray]);
titulo_txt.text = descripcion[posarray];
posicion_txt.text = posarray+1+" / "+total;
}
}
////Buttons actions/////////
this.adelante_btn.onRelease = function(){
SiguienteImagen();
}
this.atras_btn.onRelease = function(){
AnteriorImagen();
}
I hope some of you might help me to modify the code so I will be able to finish this work.
Thanks in Advance.
Grettings
Paul MB…
:be: