Precarga MovieClipLoader
Publicado por Shimaryu (1 intervención) el 27/03/2008 21:50:23
Hola que tal, tengo un problema con una precarga de multiples archivos .jpg de uan galeria, aca esta el código:
Dir = "img/4/";
sep = 2;
filas = 1;
columnas = 65;
escala = 18.78;
xIni = 0;
yIni = 0;
n = 0;
var precarga_mcl:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();
Stage.showMenu = false;
listener.onLoadStart = function(target_jpg) {
_root.attachMovie("barra_mc", "barra", _root.getNextHighestDepth());
_root.barra._y = 301.9;
_root.barra._x = -192.4;
};
listener.onLoadProgress = function(target_jpg, loadedBytes, totalBytes) {
var porcentaje:Number;
porcentaje = Math.round((loadedBytes*100)/totalBytes);
_root.barra.gotoAndStop(porcentaje);
target_mc._visible = false;
target_mc.stop();
};
listener.onLoadComplete = function(target_jpg) {
_root.barra.removeMovieClip();
target_mc._visible = true;
target_mc.play();
};
precarga_mcl.addListener(listener);
for (var f = 0; f<filas; f++) {
for (var c = 0; c<columnas; c++) {
n++;
fotos = attachMovie("id_foto", "foto"+n, n);
fotos.createEmptyMovieClip("nuevo", 20);
fotos._xscale = escala;
fotos._yscale = escala;
fotos._x = (sep+fotos._width)*c+xIni;
fotos._y = (sep+fotos._height)*f+yIni;
precarga_mcl.loadClip(Dir+n+".jpg", fotos.nuevo);
fotos.n = n;
fotos.onPress = function() {
loadMovieNum("flashazo.swf", 50);
_root.foto_mc.loadMovie(Dir+this.n+".jpg");
};
}
}
Parece funcionar todo bien, pero las imagenes no me las muestra en el menu pero si aparece cuando las cliqueo (aunque no se vean en el menu, estan) y aparte no hace lo que mas necesito que es la precarga, es como si se lo saltara, pone la barra al 100% y se queda un buen rato hasta q carga todas las imagenes, si alguien tienen idea de q esta pasando, por favor una ayuda... GRACIAS!
Saludos.-
Dir = "img/4/";
sep = 2;
filas = 1;
columnas = 65;
escala = 18.78;
xIni = 0;
yIni = 0;
n = 0;
var precarga_mcl:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();
Stage.showMenu = false;
listener.onLoadStart = function(target_jpg) {
_root.attachMovie("barra_mc", "barra", _root.getNextHighestDepth());
_root.barra._y = 301.9;
_root.barra._x = -192.4;
};
listener.onLoadProgress = function(target_jpg, loadedBytes, totalBytes) {
var porcentaje:Number;
porcentaje = Math.round((loadedBytes*100)/totalBytes);
_root.barra.gotoAndStop(porcentaje);
target_mc._visible = false;
target_mc.stop();
};
listener.onLoadComplete = function(target_jpg) {
_root.barra.removeMovieClip();
target_mc._visible = true;
target_mc.play();
};
precarga_mcl.addListener(listener);
for (var f = 0; f<filas; f++) {
for (var c = 0; c<columnas; c++) {
n++;
fotos = attachMovie("id_foto", "foto"+n, n);
fotos.createEmptyMovieClip("nuevo", 20);
fotos._xscale = escala;
fotos._yscale = escala;
fotos._x = (sep+fotos._width)*c+xIni;
fotos._y = (sep+fotos._height)*f+yIni;
precarga_mcl.loadClip(Dir+n+".jpg", fotos.nuevo);
fotos.n = n;
fotos.onPress = function() {
loadMovieNum("flashazo.swf", 50);
_root.foto_mc.loadMovie(Dir+this.n+".jpg");
};
}
}
Parece funcionar todo bien, pero las imagenes no me las muestra en el menu pero si aparece cuando las cliqueo (aunque no se vean en el menu, estan) y aparte no hace lo que mas necesito que es la precarga, es como si se lo saltara, pone la barra al 100% y se queda un buen rato hasta q carga todas las imagenes, si alguien tienen idea de q esta pasando, por favor una ayuda... GRACIAS!
Saludos.-
Valora esta pregunta


0