Ver Mensaje Individual
  #4 (permalink)  
Antiguo 28/01/2009, 10:27
snakepit
 
Fecha de Ingreso: diciembre-2001
Ubicación: Argentina
Mensajes: 693
Antigüedad: 22 años, 4 meses
Puntos: 1
Respuesta: Como puedo hacer un slide de imagenes xml como este porfavor

Hola, estuve probando el codigo que me pasaste de esa pagina pero no me anda... algo estoy haciendo mal, Pongo este codigo en el primer frame de mi pelicula y guardo las fotos en una carpeta llamada fotos con el nombre 0.jpg, 1.jpg etc. pero no pasa absolutamente nada. No cree ningun mc vacio porque segun lo que leo en el codigo, ese se crea con as.

bueno este es el codigo si alguien sabes que esta pasando se lo agradezco. saludos

Código:
//-------------------------------------------------------- 
// Creo Vars y Arrays: 

var totalCargas:Number = 0; 
var inicia:Boolean = false; 
var CantFotos:Number = 4;

var cargoFotos:Array = new Array(); 
var misFotos:Array = new Array(); 

for (var i=0; i<CantFotos; i++) {
misFotos[i]="Fotos/"+i+".jpg";
}
 
 

//-------------------------------------------------------- 
//Variables iniciales 
var frames:Number = 0; 
var framesMax:Number = 50; 
var index:Number = -1; 
 
//-------------------------------------------------------- 
// Cargo misFotos en EmptyMovieClips: 
for (i=0; i<misFotos.length; i++) 
{    
   _root.createEmptyMovieClip("cargo"+i,_root.getNextHighestDepth()); 
   cargoFotos[i] = _root["cargo"+i]; 
    
   var mclListener:Object = new Object(); 
 
   var image_mcl:MovieClipLoader = new MovieClipLoader(); 
   image_mcl.addListener(mclListener); 
    
   mclListener.onLoadStart = function(target_mc:MovieClip) {  
   // trace ('1. onLoadStart');    
   }; 
   mclListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void { 
   // trace('2. onLoadProgress'+target_mc + ".onLoadProgress with " + bytesLoaded + " bytes of " + bytesTotal); 
   } 
   mclListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void { 
   // trace ('3. onLoadComplete'); 
   } 
    
   // AQUI: Inicio de imagen cargada, comprobacion de cargas totales 
   mclListener.onLoadInit = function(target_mc:MovieClip):Void { 
   trace ('4. onLoadInit'); 
    var timerMS:Number = target_mc.completeTimer-target_mc.startTimer; 
   // 
    var w:Number = target_mc._width; 
    var h:Number = target_mc._height; 
    target_mc._x = 0; 
    target_mc._y = 0; 
   target_mc._alpha = 0; 
    target_mc.lineStyle(1, 0x000000); 
    target_mc.moveTo(0, 0); 
    target_mc.lineTo(w, 0); 
    target_mc.lineTo(w, h); 
    target_mc.lineTo(0, h); 
    target_mc.lineTo(0, 0); 
   // Acomodo final de imagenes 
   target_mc._width = Stage.width; 
    target_mc._height = Stage.height; 
 
   // Comprueba para entonces inicio Tween... 
   checkProgress(); 
   totalCargas++; 
   //  
   // if(totalCargas==cargoFotos.length)             // OPCION (1), si se requiere que esten todas las imagenes cargadas 
   if((totalCargas>cargoFotos.length/2) && (inicia))    // OPCION (2), se requiere que este la mitad del total de imagenes cargadas 
   { 
   trace('YA ESTAN TODOS CARGADOS o YA CARGO LA PRIMERA MITAD --> '+inicia); 
   // remove preloader 
   // ... 
   // AHORA SI... !!INICIO!!  =) 
   showPics(); 
   } else { 
   // preloader 'cargando elementos'; 
   // aquiopuedes atar un preloader o mostrar txt de precarga 
   } 
   }    
 
   image_mcl.loadClip(misFotos[i], cargoFotos[i]); 
} 
 
//-------------------------------------------------------- 
// Función que checa el progreso de precarga de las imagenes: 
function checkProgress () { 
   inicia = true; 
   for(var p=0; p<cargoFotos.length/2; p++) { 
   if (cargoFotos[p].getBytesLoaded()!=cargoFotos[p].getBytesTotal()) 
   inicia = false; 
   } 
} 
//-------------------------------------------------------- 
// Función que transiciona imágenes: 
function CambioAlpha( elClip1:MovieClip, elClip2:MovieClip):Void  
{ 
   new Tween(elClip1, "_alpha", Regular.easeOut, 100, 0, 1.5, true); 
   new Tween(elClip2, "_alpha", Regular.easeOut, 0, 100, 1.5, true); 
} 
 
//-------------------------------------------------------- 
// Recorro el array y transiciono: 
function Cambio( Void ):Void  
{ 
   if( index == -1 ) 
      CambioAlpha( null,cargoFotos[0] ); 
   else if( index == cargoFotos.length - 1 ) 
      CambioAlpha( cargoFotos[index], cargoFotos[0] ) 
   else 
      CambioAlpha( cargoFotos[index],cargoFotos[index + 1] ); 
   // 
   index = ( index + 1 < cargoFotos.length )? index + 1 : 0; 
} 
 
//-------------------------------------------------------- 
// Cuento frames para ejecutar la funcion de transición: 
function showPics ( Void ):Void { 
this.onEnterFrame = function () 
{ 
   ( frames < framesMax )? frames++ : frames=0;    
   if ( frames >= framesMax )  
   { 
      Cambio(); 
   } 
} 
}