Foros del Web » Creando para Internet » Flash y Actionscript »

Usar buffer?

Estas en el tema de Usar buffer? en el foro de Flash y Actionscript en Foros del Web. me gustaria comprobar si existen 2 o mas direcciones de 1 fichero txt, en el proceso si no exite o tarda demasiado en cargar el ...
  #1 (permalink)  
Antiguo 19/05/2007, 15:10
Avatar de cplus  
Fecha de Ingreso: abril-2007
Mensajes: 164
Antigüedad: 17 años
Puntos: 1
Usar buffer?

me gustaria comprobar si existen 2 o mas direcciones de 1 fichero txt, en el proceso si no exite o tarda demasiado en cargar el txt, salta a otra y asi sucesivamente.

alguien sabe algo¿
  #2 (permalink)  
Antiguo 19/05/2007, 15:23
 
Fecha de Ingreso: septiembre-2006
Mensajes: 1.193
Antigüedad: 17 años, 6 meses
Puntos: 30
Re: Usar buffer?

de forma local no se puede, ahora si quieres hacerlo en un servidor necesitarias utilizar la funcion opendir de php junto con AS2.
  #3 (permalink)  
Antiguo 19/05/2007, 15:34
Avatar de cplus  
Fecha de Ingreso: abril-2007
Mensajes: 164
Antigüedad: 17 años
Puntos: 1
Re: Usar buffer?

yo estaba pensando en hacer un loader("txt"), y si el tiempo de carga es mayor de X segundos, salta a otro... y asi sucesivamente, si llega hasta el final sin dar OK, vuelve a empezar...

no se si me explicao bien
  #4 (permalink)  
Antiguo 19/05/2007, 18:00
Avatar de cplus  
Fecha de Ingreso: abril-2007
Mensajes: 164
Antigüedad: 17 años
Puntos: 1
Re: Usar buffer?

Código PHP:
//*********************************************************************
// flash vA1.00
//*********************************************************************
function randRange(min:Numbermax:Number):Number {
    var 
randomNum:Number Math.floor(Math.random() * (max min 1)) + min;
    return 
randomNum;
}
//end func
//*********************************************************************
for (var 0100i++) {
       var 
n:Number randRange(536539)
}
//end for
//*********************************************************************
if(== "536"){
    var 
w_hoppye "http://xxxx/code20.txt";
    var 
my_lv:LoadVars = new LoadVars();
    
my_lv.onLoad = function(success:Boolean) {
        if(
success){
            
txt.text "Servidor 1 OK";            
            
texto.text w_hoppye;
            
fscommand("",w_hoppye);            
        }else{
            
txt.text "Servidor 1 Caido !";            
            
stop();
            var 
nInterval setInterval(Play6000);
            function 
Play() {
                
txt.text "Buscando !";            
                
clearInterval(nInterval);
            }
//end func
            
gotoAndPlay("1");
        }
//end if
    
};//end func
  
my_lv.load(w_hoppye);        
}
//end if
//*********************************************************************    
if(== "537"){
    var 
w_hoppye "http://xxxx/code20.txt";
    var 
my_lv:LoadVars = new LoadVars();
    
my_lv.onLoad = function(success:Boolean) {
        if(
success){
            
txt.text "Servidor 2 OK";            
            
texto.text w_hoppye;
            
fscommand("",w_hoppye);
        }else{
            
txt.text "Servidor 2 Caido !";            
            
stop();
            var 
nInterval setInterval(Play6000);
            function 
Play() {
                
txt.text "Buscando !";            
                
clearInterval(nInterval);
            }
//end func
            
gotoAndPlay("1");
        }
//end if
    
};//end func
  
my_lv.load(w_hoppye);        
}
//end if
//*********************************************************************
if(== "538"){
    var 
w_hoppye "http://xxxx/code20.txt";
    var 
my_lv:LoadVars = new LoadVars();
    
my_lv.onLoad = function(success:Boolean) {
        if(
success){
            
txt.text "Servidor 3 OK";            
            
texto.text w_hoppye;
            
fscommand("",w_hoppye);
        }else{
            
txt.text "Servidor 3 Caido !";            
            
stop();
            var 
nInterval setInterval(Play6000);
            function 
Play() {
                
txt.text "Buscando !";            
                
clearInterval(nInterval);
            }
//end func
            
gotoAndPlay("1");
        }
//end if
    
};//end func
  
my_lv.load(w_hoppye);        
}
//end if
//*********************************************************************
if(== "539"){
    var 
w_hoppye "http://xxxx/code20.txt";
    var 
my_lv:LoadVars = new LoadVars();
    
my_lv.onLoad = function(success:Boolean) {
        if(
success){
            
txt.text "Servidor 4 OK";            
            
texto.text w_hoppye;
            
fscommand("",w_hoppye);
        }else{
            
txt.text "Servidor 4 Caido !";            
            
stop();
            var 
nInterval setInterval(Play6000);
            function 
Play() {
                
txt.text "Buscando !";            
                
clearInterval(nInterval);
            }
//end func
            
gotoAndPlay("1");
        }
//end if
    
};//end func
  
my_lv.load(w_hoppye);        
}
//end if
//*********************************************************************
stop(); 
al final hice algo asi... pero es demasiado codigo para añadir 20 por ejemplo....

alguien sabe como reducir esto...
  #5 (permalink)  
Antiguo 19/05/2007, 18:32
 
Fecha de Ingreso: septiembre-2006
Mensajes: 1.193
Antigüedad: 17 años, 6 meses
Puntos: 30
Re: Usar buffer?

es una especie de algoritmo prueba si te sirve

Código:
function inicio() {
	trace("cargando texto 1 Tiempo limite 5 segundos");
}
inicio();
var contador:Number = 0;
var id_num:Number = 1;
function tiempo() {
	contador++;
	trace("tiempó "+contador);
	if (contador>5) {
		contador = 0;
		id_num++;
		texto(id_num);
		trace("termino texto "+((id_num)-1)+"\n");
		trace("cargando texto "+id_num+" Tiempo limite 5 segundos");

	}
}
setInterval(tiempo,1000);

function texto(id:Number) {
	trace("TEXTO.TXT "+id);
}
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:27.