Ver Mensaje Individual
  #12 (permalink)  
Antiguo 21/10/2006, 20:07
Avatar de nuevo
nuevo
 
Fecha de Ingreso: mayo-2003
Ubicación: Spain
Mensajes: 2.009
Antigüedad: 21 años
Puntos: 2
el problema: el txt no se carga antes de iniciar la funcion de aleatorio... con lo cual imposible que sepa el valor, hay que iniciar una funcion que lo controle si cargo o no...

Código PHP:
var numero_images:Number;
var 
valorAleatorio:Number;
//--------------------->
var cargador_lv:LoadVars = new LoadVars();
cargador_lv.onLoad = function(exito){
    if(
exito){
        
comenzar();
    }else{
        
trace("Error!! No se puede abrir el txt");
    }
};
//--------------------->
var comenzar:Function = function():Void{
    
numero_images Number(cargador_lv.numero_images);
    
valorAleatorio 0+Math.round(Math.random()*numero_images);
    
trace('numero_images -> '+numero_images);//muestra si funciona
    
trace('valorAleatorio -> '+valorAleatorio);//muestra si funciona
    
this.createEmptyMovieClip("img_mc", ++nivel);
    
img_mc._x 0;
    
img_mc._y 0;
    
img_mc.loadMovie("images/novedades/foto_novedades/0"+valorAleatorio+".jpg");
}
//--------------------->
cargador_lv.load("images/novedades.txt"); 
//--------------------->
this.createEmptyMovieClip("bucle_mc", ++nivel);
bucle_mc.onEnterFrame = function() {
    if (
por != 100) {
        
loading_txt.text "Cargando";
        
por Math.round((img_mc.getBytesLoaded()/img_mc.getBytesTotal())*100);
        
por_txt.text = (Math.round(img_mc.getBytesLoaded()/1024))+"Kb de "+(Math.round(img_mc.getBytesTotal()/1024))+"Kb "+por+"%";
    } else {
        
this.unloadMovie();
        
img_mc._width 98;
        
img_mc._height 98;
        
nextFrame();
    }
};
stop(); 
ya funciona, gracias leo