Ver Mensaje Individual
  #5 (permalink)  
Antiguo 26/01/2011, 06:29
polo_W12
 
Fecha de Ingreso: enero-2008
Ubicación: Concepción, Chile
Mensajes: 76
Antigüedad: 16 años, 3 meses
Puntos: 3
Respuesta: como se hace un Loading

Cita:
Iniciado por cobossagrav Ver Mensaje
encontre esto:



pero no tengo idea de como aplicarlo haber si me ayudan

Amigo se me ocurre lo siguiente para multiples Fotografias:

Código ACTIONSCRIPT:
Ver original
  1. import flash.display.Loader;
  2. import flash.display.Sprite;
  3. import flash.events.*;
  4. import flash.net.URLRequest;
  5.  
  6. CargarFoto();
  7.  
  8. function CargarFoto() {
  9.     var i:uint                  = 0;
  10.     var t:uint                  = 5;
  11.     for(i=0; i<t; i++){
  12.         var url:String              = "Resident5 ("+i+").jpg";
  13.         var loader:Loader           = new Loader();
  14.         ponerListeners(loader.contentLoaderInfo);
  15.         var peticion:URLRequest     = new URLRequest(url);
  16.         loader.load(peticion);
  17.     }
  18. }
  19.  
  20. function ponerListeners(obj:IEventDispatcher):void {
  21.     obj.addEventListener(Event.COMPLETE, completeHandler);
  22.     obj.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
  23.     obj.addEventListener(Event.INIT, initHandler);
  24.     obj.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
  25.     obj.addEventListener(Event.OPEN, openHandler);
  26.     obj.addEventListener(ProgressEvent.PROGRESS , progressHandler);
  27. }
  28.  
  29. function completeHandler(a:Event):void {
  30.     addChild(a.target.content);
  31. }
  32.  
  33. function httpStatusHandler(a:HTTPStatusEvent):void {
  34.     trace("httpStatus: "+a.status);
  35. }
  36.  
  37. function initHandler(a:Event):void {
  38.     //trace("initHandler");
  39. }
  40.  
  41. function ioErrorHandler(a:IOErrorEvent):void {
  42.     //trace("ioError");
  43. }
  44.  
  45. function openHandler(a:Event):void {
  46.     //trace("open");
  47. }
  48.  
  49. function progressHandler(a:ProgressEvent):void {
  50.     var cur:int                 = int((a.bytesLoaded*100)/a.bytesTotal);
  51.     trace(cur,"%");
  52. }

Y para cargar múltiples SWF se me ocurre lo siguiente

Código ACTIONSCRIPT:
Ver original
  1. import flash.display.Loader;
  2. import flash.display.Sprite;
  3. import flash.events.*;
  4. import flash.net.URLRequest;
  5.  
  6. CargarFoto();
  7.  
  8. function CargarFoto() {
  9.     var i:uint                  = 0;
  10.     var t:uint                  = 5;
  11.     for(i=0; i<t; i++){
  12.         var url:String              = "swf"+i+".swf";
  13.         var loader:Loader           = new Loader();
  14.         ponerListeners(loader.contentLoaderInfo);
  15.         var peticion:URLRequest     = new URLRequest(url);
  16.         loader.load(peticion);
  17.     }
  18. }
  19.  
  20. function ponerListeners(obj:IEventDispatcher):void {
  21.     obj.addEventListener(Event.COMPLETE, completeHandler);
  22.     obj.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
  23.     obj.addEventListener(Event.INIT, initHandler);
  24.     obj.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
  25.     obj.addEventListener(Event.OPEN, openHandler);
  26.     obj.addEventListener(ProgressEvent.PROGRESS , progressHandler);
  27. }
  28.  
  29. function completeHandler(a:Event):void {
  30.     addChild(a.target.content);
  31. }
  32.  
  33. function httpStatusHandler(a:HTTPStatusEvent):void {
  34.     trace("httpStatus: "+a.status);
  35. }
  36.  
  37. function initHandler(a:Event):void {
  38.     //trace("initHandler");
  39. }
  40.  
  41. function ioErrorHandler(a:IOErrorEvent):void {
  42.     //trace("ioError");
  43. }
  44.  
  45. function openHandler(a:Event):void {
  46.     //trace("open");
  47. }
  48.  
  49. function progressHandler(a:ProgressEvent):void {
  50.     var cur:int                 = int((a.bytesLoaded*100)/a.bytesTotal);
  51.     trace(cur,"%");
  52. }

Saluda Atte.
Claudio Barrera Asencio.

Última edición por polo_W12; 26/01/2011 a las 06:40 Razón: Respuesta incompleta