Tengo un 1er codigo que carga una imagen centrada en un movieclip:
Código ActionScript :
var ancho_total:Number = Stage.width;
var alto_total:Number = Stage.height;
this.createEmptyMovieClip("cargador", 1);
cargador.loadMovie("images/editorial_700/alain_700px_01.jpg");
function carga() {
var van:Number = cargador.getBytesLoaded();
var totales:Number = cargador.getBytesTotal();
var porcentaje:Number = Math.round((van/totales)*100);
if (porcentaje == 100) {
cargador._x = (ancho_total-cargador._width)/2;
cargador._y = (alto_total-cargador._height)/2;
trace("Ancho: "+cargador._width+". Alto: "+cargador._height);
clearInterval(intervalo);
}
}
var intervalo:Number = setInterval(carga, 100); Cómo puedo agregarle este otro codigo a esa misma carga de imagen?????
Código ActionScript :
_global.smoothImageLoad = function(imgURL, targetMovie) {
var i=0
do { i++ } while (eval("_root.smoothImageLoadTemp"+i) != undefined)
tmc = _root.createEmptyMovieClip("smoothImageLoadTemp"+i, _root.getNextHighestDepth())
tmc.createEmptyMovieClip("ti", tmc.getNextHighestDepth())
tmc.tm = targetMovie
with(tmc) {
tmcl = new MovieClipLoader()
tmcl.onLoadComplete = function() {
ti.onEnterFrame = function() {
pixelData = new flash.display.BitmapData(ti._width, ti._height);
pixelData.draw(ti);
tm.attachBitmap(pixelData, 1, true, true);
tm.smoothImageLoadComplete()
removeMovieClip(ti._parent)
}
}
tmcl.loadClip(imgURL, tmc.ti)
}
}
mymc.smoothImageLoadComplete = function() {
trace("yeah baby yeah!!!")
}
smoothImageLoad("images/700/alain_big_0369.png", contenedor_lkbk)
Es posible unir los dos codigos?
