I work with KM. and I made a Gallery, that target the image from URL with LoadMovie and I need a preload for target the image in a mc (container). MovieClipLoader class don´t work in KM. How can I to made a preload for image ? Thanks.
Printable View
I work with KM. and I made a Gallery, that target the image from URL with LoadMovie and I need a preload for target the image in a mc (container). MovieClipLoader class don´t work in KM. How can I to made a preload for image ? Thanks.
MovieClipLoader works I believe.
Probably, but I not if it exists for AS 1, which I have is AS 2, and does not work in km.
Mi code Is:
Thaks, for you response.Code:var precargador_mcl:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();
Stage.showMenu = false;
listener.onLoadStart = function(target_mc) {
trace("Iniciando");
_root.attachMovie("barra", "barra_mc", _root.getNextHighestDepth());
_root.barra_mc._y = Stage.height/2;
_root.barra_mc._x = Stage.width/2;
};
listener.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
trace("En progreso");
var porcentaje:Number;
porcentaje = Math.round((loadedBytes*100)/totalBytes);
_root.barra_mc.gotoAndStop(porcentaje);
target_mc._visible = false;
target_mc.stop();
};
listener.onLoadComplete = function(target_mc) {
trace("ya");
_root.barra_mc.removeMovieClip();
target_mc._visible = true;
target_mc.play();
};
precargador_mcl.addListener(listener);
cargar_btn.onRelease = function() {
nocache = "?nocaching="+random(65000);
precargador_mcl.loadClip("image1.jpg"+nocache, caja_mc);
};
AS2 isn't supported by KM.
If you port the code to AS1 it should work fine since Bret is right. MovieClipLoader is supported and works fine.
Already I have solved the problem. I still have that the code to purify a bit that it is sure that this slightly dirty, but now it is working perfectly at KM.
The code is now:
It´s working now yours can see:Code:Stage.scaleMode = "noScale";
//recibe bytes devuleve kb
function bytes2kb(val){
return Math.round(val/1024)
}
//holder para el contenido.
createEmptyMovieClip("holder",1);
//atachamos el preloader.
attachMovie("loader","loader",2,{_x:283,_y:229});
loader.box.autoSize = "right";
loader.barra._xscale = 1;
//objeto mcloader
my_mcl = new MovieClipLoader();
//listener
my_mcl_listener = new Object();
//callback para cuando empieze la carga
my_mcl_listener.onLoadStart = function(t){
trace("inicia carga");
t._visible = false;
}
//callback cada vez que se cargue algo
my_mcl_listener.onLoadProgress = function (t,bl,bt){
var p = (bl / bt) * 100
loader.box.text = "cargados: " + bytes2kb(bl) + " de " + bytes2kb(bt) + "KB";
loader.barra._xscale = p;
}
//callback en caso de error
my_mcl_listener.onLoadError = function (t,ec){
trace("ups! error " + ec)
loader.box.text = ec;
}
//callback para cuando se termina la carga.
my_mcl_listener.onLoadComplete = function(t){
loader._visible = false;
t._visible = true;
trace("fin de la carga.");
}
//agregamos el listener al mcloader
my_mcl.addListener(my_mcl_listener);
//cargamos la imagen.
my_mcl.loadClip("index.swf",holder);
stop();
HERE
Thanks infinites for your attention and I sorry for the coment in this code, it is spanish, that is my language.