// ------------------------------------------------------------------------------- // Preloader swfs, jpgs, etc... // // Parametros: // swf - pelicula o jpg // mcDestino - MovieClip donde se carga // mcIndicador - MovieClip indicador de precarga // x, y - coordenadas x, y del indicador (si es null, no cambia la posicion) // callback - funcion callback que es llamada cuando termina la precarga // ------------------------------------------------------------------------------- _global.preloadMovie = function(swf, mcDestino, mcIndicador, x, y, texto, callback) { if (x != null && y != null) { mcIndicador._x = x; mcIndicador._y = y; } if (texto == undefined || texto == null) { texto = ''; } mcIndicador.txt = texto; mcIndicador.mcContenedor = mcDestino; // Llama la pelicula loadMovie(swf, mcIndicador.mcContenedor); // Inicializa precargador ... mcIndicador.barra_mc._xscale = 0; mcIndicador._visible = false; mcIndicador._parent.scrollText(mcIndicador.texto_mc); // Control de precarga ... mcIndicador.onEnterFrame = function() { mcIndicador.bl = eval(mcIndicador.mcContenedor).getBytesLoaded(); mcIndicador.bt = eval(mcIndicador.mcContenedor).getBytesTotal(); // Bytes totales ya tienen valor (>16bytes)? if ( mcIndicador.bt != undefined && mcIndicador.bt >= 16 ) { mcIndicador._visible = true; if ( mcIndicador.bl >= mcIndicador.bt ) { // fin precarga delete mcIndicador.onEnterFrame; mcIndicador.p = 100; mcIndicador.barra_mc._xscale = mcIndicador.p; mcIndicador._visible = false; // Llamada a la funcion callback callback.call(null,mcIndicador.mcContenedor); } else { // Precargando... mcIndicador.p = Math.round(mcIndicador.bl * 100 / mcIndicador.bt); mcIndicador.txt = texto + mcIndicador.p + "%"; mcIndicador.barra_mc._xscale = mcIndicador.p; mcIndicador.porcentaje_txt._x = mcIndicador.barra_mc._x + mcIndicador.barra_mc._width; } } } } //