HOLA !!!

Yo utilizo esta función de Hellen Triollo de as-toolbox hace tiempo y me va muy bién.

http://actionscript-toolbox.com/samplemx_loadjpg.php


Para que la carga sea secuencial solo tienes que definir en el callback oncomplete() una función que chequee si debe cargar la siguiente.
Y para los preloaders lo mismo en onLoading()

Ana y yo estubimos en el taller de SubFlash y comentamos el proyecto de sueños compartidos <http://www.yuzin.com/individuocolectivo> que presentamos al concurso de ingenio400 <http://www.ingenio400.com/> Estamos trabajando para hacerlo interactivo y que quien visite pueda subir los suyos y hacerle una interfaz más currada.
El taller fué fantástico. Un verdadero placer compartir con gente tan maja.

En el proyecto utilizamos un "fotovisor" que deriva del cargador de Hellen Triollo. Está muy mal comentado y peor organizado, pero funciona, y menos da una piedra. El código carga una lista de fotos de un directorio generada automáticamente por un PHP, y lee un TXT con datos sobre como organizar las fotos (en una fila, una columna, o en x filas y columnas).


Una versión anterior del "fotovisor" en la que se visualiza mejor la precarga:
http://www.madreselvaflores.com/sergio/fotovisor/foto_visor.html
(pero la carga secuencial no llega  a detenerse correctamente)

Os pego el código de la última versión del fotovisor que utilizamos en individuocolectivo -es un follón, y utiliza un montón de prototipos del index, así que adjunto link de descarga a un zip con todos los PHP TXT FLAS ETC...
http://www.yuzin.com/individuocolectivo/individuocolectivo.zip



//____________________________CARGAR LISTA DE FOTOS Y DISPLAY

lista_de_fotos_lv = new LoadVars ();
foto_comp_data_lv = new LoadVars ();
if ( ! G_foto_dir)
{
   G_foto_dir = "fotos";
}
if ( ! component_data_dir)
{
   component_data_dir = "component_data";
}
if ( ! foto_script_path)
{
   foto_script_path = "fotos/lista_de_fotos.php";
}
iniciar_fotovisor = function ()
{
   var foto_comp_data_path = "component_data/foto_component_data.txt";
   foto_comp_data_lv.load (foto_comp_data_path);
};
foto_comp_data_lv.onLoad = function ()
{
   foto_comp_data_lv ["ui"] = foto_comp_data_lv ["ui"].split ("|");
   _parent.fotovisor._action = foto_comp_data_lv ["ui"][0];
   _parent.fotovisor._stgW = Number (foto_comp_data_lv ["ui"][1]);
   _parent.fotovisor._stgH = Number (foto_comp_data_lv ["ui"][2]);
   _parent.fotovisor._c = Number (foto_comp_data_lv ["columnas"]);
   _parent.fotovisor._air = Number (foto_comp_data_lv ["air"]);
_parent.fotovisor._xd = Number (foto_comp_data_lv ["thumb_size"]) + Number (_air);
   lista_de_fotos_lv.load (foto_script_path);
};
lista_de_fotos_lv.onLoad = function ()
{
   _global._totalfotos = lista_de_fotos_lv.totalfotos;
   duplica (_totalfotos);
};
//____________________________DUPLICAR CONTENEDORES
duplica = function (_totalfotos)
{
   _parent._visible = true;
   this.attachMovie ("foto_item", "item", 1);
   xi = 0;
   yi = 0;
   hi = item1._height - 1;
   hti = hi * _totalfotos;
   sequence = new Array ();
   var idup = 0;
   var th = this;
   var myintervalID;
   myintervalID = setInterval (function ()
   {
       idup ++;
       if (idup > _totalfotos)
       {
           //COLOCAR CONTENEDORES E INICIAR CARGA DE FOTOS
           removeMovieClip ("item");
           move_fotos ();
           lista_de_fotos_lv.fotos_cargadas = 0;
           th ["item" + 1].loadjpg (1);
           clearInterval (myintervalID);
       }
       n = idup;
lista_de_fotos_lv ["item" + idup] = lista_de_fotos_lv ["item" + idup].split ("|");
       duplicateMovieClip ("item", "item" + n, n * 3);
       var pip = lista_de_fotos_lv ["item" + idup];
       var t = th ["item" + n];
       t.order = n;
       t.pic_b.m = n;
t._foto_info = pip [0] + " :: " + pip [1] + "x" + pip [2] + " :: " + pip [3];
       t._foto = G_foto_dir + "/" + pip [0];
       t._fotoname = pip [0];
       t._fw = pip [1];
       t._fh = pip [2];
       t._fkb = pip [3];
       var ths = foto_comp_data_lv ["thumb_size"];
       t.pic_b._width = ths;
       t.pic_b._height = ths;
       t._thsz = ths;
       t.drawRectFill (0, 0, ths, ths, 0x838FA6, 100);
       //_________________ACCIONES PARA LAS FOTOS
       t.pic_b.onRelease = t.pic_b.onReleaseOutside = function ()
       {
       }
       t.pic_b.onPress = function ()
       {
           h = random (9);

           t.attachMovie ("circulo" + h, "cir_new", 30000);
           trice("circulo" + h)
           var prueba=t._fotoname.strReplace(".jpg","");
var goescrol=((0-(-_root.dreams.animacion[prueba]._x + 300))*780/_root.dreams._width);
           trace("***********"+goescrol);
           _root.dreams.animacion[prueba]._visible=true;
_root.dreams._escrol.sc.floatTo(0.5,_root.dreams._escrol.sc._x,goescrol); _root.dreams.floatTo(0.7,-_root.dreams.animacion[prueba]._x + 300,_root.dreams._y); _root.dreams.animacion.attachMovie("estrellita","estrellita_new",24); _root.dreams.animacion.estrellita_new._x=_root.dreams.animacion[prueba]._x - 40; _root.dreams.animacion.estrellita_new._y=_root.dreams.animacion[prueba]._y -40;


       }
   }, 05, th);
};
//____________________________PROTOTIPOS PARA REDUCIR Y CENTRAR FOTOS/MCS
MovieClip.prototype.resizeToFit = function (thumb_size)
{
   ratio = this._width / this._height;
   this._width = ratio > 1 ? thumb_size : thumb_size * ratio;
   this._height = ratio > 1 ? thumb_size / ratio : thumb_size;
   this.centerinparent ();
};
MovieClip.prototype.centerinparent = function ()
{
   this._x = this._parent._width / 2 - this._width / 2;
   this._y = this._parent._height / 2 - this._height / 2;
};
//____________________________CARGAR FOTOS
MovieClip.prototype.loadjpg = function (next_n)
{
   var h = "holder";
   this.createEmptyMovieClip (h, 20000);
   this [h]._visible = false;
this [h].loadMovie (G_foto_dir + "/" + lista_de_fotos_lv ["item" + next_n][0]);
   //_PRELOADER
   this.attachMovie ("preloader", "preloader", 20007);
   this.preloader.preloader.pip1.kb.text = this._fkb;
   this.preloader.preloader.pip2.kb.text = this._fkb;
   this.preloader.centerinparent ();
   var id = setInterval (function (mc,nn)
   {
       var bl = mc [h].getBytesLoaded ();
       var bt = mc [h].getBytesTotal ();
       if (bl > 12)
       {
           if (bl > 12 && bl >= bt && mc [h]._width > 0 || bt == - 1)
           {
               mc.preloader.unloadMovie ();
               mc [h]._visible = true;
               mc [h].resizeToFit (foto_comp_data_lv ["thumb_size"]);
               var cargarsiguiente = (nn == _totalfotos) ? false : true;
               if (cargarsiguiente)
               {
                   clearInterval (id);
                   nn++;
                   mc._parent ["item" + nn].loadjpg (nn);
               } else
               {
                   clearInterval (id);
               }
                   clearInterval (id);
           } else
           {
               //_PRELOADER
               var perc = Math.floor (bl * 100 / bt);
               mc.preloader.preloader.gotoAndStop (perc);
           }
       }
   }, 10, this,next_n);
};
//____________________________MOVER FOTOS
move_fotos = function ()
{
   var next_x = _air;
   var next_y = _air;
   for (f = 1; f <= _totalfotos; f ++)
   {
       var pip = this ["item" + f];
       if (_action == "deck")
       {
           pip.floatTo (0.7, next_x, next_y);
           if (f % _c == 0)
           {
               next_x = _air;
               next_y += _xd;
           } else
           {
               next_x += _xd;
           }
       }
       if (_action == "vertical")
       {
           next_x = _air;
           pip.floatTo (0.7, next_x, next_y);
           next_y += _xd;
       }
       if (_action == "horizontal")
       {
           next_y = _air;
           pip._x = next_x;
           pip._y = next_y;
           next_x += _xd;
       }
       if (f == _totalfotos)
       {
           break;
       }
   }
};
iniciar_fotovisor ();




----------------------------------
Lista ASNativos:[email protected]
http://www.5dms.com/listas
----------------------------------

Responder a