Comunidad de diseño web y desarrollo en internet online

Cambiar nombre a loadvars

Citar            
MensajeEscrito el 12 Feb 2009 07:48 pm
Hola, tengo este codigo dentro de un boton para crear un loadvars:

Código :

on(release){
var chat_lv:LoadVars = new LoadVars();

chat_lv.onLoad = function(exito) {
   if (exito) {
      chat_txt.text = arreglarTexto(chat_lv.toString());
   } else {
      chat_txt.text = "Error!! :(";
   }
};

function arreglarTexto(texto_str:String):String {
   texto_str = unescape(texto_str);
   return texto_str.substr(0, texto_str.length-24);
}
   chat_lv.load("Chat.txt");

}


Pero lo que quiero conseguir es que cada vez que se pulse el boton, el loadvars cambie de nombre, por ejemplo: clat_lv1, Chat_lv2, Chat_lv3...
He echo este codigo:

Fuera del boton:

Código :

Refresh = 1;

En el boton:

Código :

on(release){
   ++refresh
   ver.text = refresh;

var chat_lv + refresh:LoadVars = new LoadVars();

chat_lv + refresh.onLoad = function(exito) {
   if (exito) {
      chat_txt.text = arreglarTexto(chat_lv + refresh.toString());
   } else {
      chat_txt.text = "Error!! :(";
   }
};
function arreglarTexto(texto_str:String):String {
   texto_str = unescape(texto_str);
   return texto_str.substr(0, texto_str.length-24);
}
   chat_lv + refresh.load("Chat.txt");

}

Y no funciona, también he provado de cambiar "Chat_lv + Refresh" por "resfresh" solo, pero tampoco funciona


Como puedo hacer esto?

Gracias.

Por -cibernetik-

72 de clabLevel



 

msie7
Citar            
MensajeEscrito el 12 Feb 2009 07:55 pm

Código ActionScript :

on(release){
   ++refresh
   ver.text = refresh;

var eval("chat_lv" + refresh):LoadVars = new LoadVars();

eval("chat_lv" + refresh).onLoad = function(exito) {
   if (exito) {
      chat_txt.text = arreglarTexto("chat_lv"+ refresh.toString());
   } else {
      chat_txt.text = "Error!! :(";
   }
};
function arreglarTexto(texto_str:String):String {
   texto_str = unescape(texto_str);
   return texto_str.substr(0, texto_str.length-24);
}
   chat_lv + refresh.load("Chat.txt");

}

Por nasho

Claber

908 de clabLevel

1 tutorial

Genero:Masculino  

Web Developer

firefox
Citar            
MensajeEscrito el 12 Feb 2009 07:57 pm
falto el ultimo

Código ActionScript :

eval("chat_lv" + refresh).load("Chat.txt"); 

Por nasho

Claber

908 de clabLevel

1 tutorial

Genero:Masculino  

Web Developer

firefox
Citar            
MensajeEscrito el 12 Feb 2009 08:10 pm
He provado ese codigo y tampoco funciona, en la bandeja de salida da 3 errores:

Syntax error -> var eval("chat_lv" + refresh):LoadVars = new LoadVars();
Statement must appear within on handler -> eval("chat_lv" + refresh).onLoad = function(exito) {
Statement must appear within on handler -> chat_lv + refresh.load("Chat.txt");

:cry:

Por -cibernetik-

72 de clabLevel



 

msie7
Citar            
MensajeEscrito el 12 Feb 2009 08:13 pm
Si cambio lo ultimo me sale como un error también.

Por cierto, trabajo con flash CS3 ActionScript 2.0

Por -cibernetik-

72 de clabLevel



 

msie7
Citar            
MensajeEscrito el 12 Feb 2009 08:16 pm
para que quieres que cambie de nombre

Por nasho

Claber

908 de clabLevel

1 tutorial

Genero:Masculino  

Web Developer

firefox
Citar            
MensajeEscrito el 12 Feb 2009 08:43 pm
Quiero hacer una especie de MiniChat muy simple usando loadvars, pero tengo un problema. Cuando el archivo .txt del loadvars se modifica (por que hay un nuevo mensaje), para que el cambio se vea en el .swf tengo que borrar los archivos temporales de internet y refrescar la pagina, porque la variable se queda guardada. Si cada vez que pulso el voton se cambia el nombre del loadvar, no pasarà esto, ya que las variables se iran guardando, pero cada vez serà un nombre distinto.

Por -cibernetik-

72 de clabLevel



 

msie7
Citar            
MensajeEscrito el 12 Feb 2009 09:42 pm

Código ActionScript :

on(release){
var chat_lv:LoadVars = new LoadVars();

chat_lv.onLoad = function(exito) {
   if (exito) {
      chat_txt.text = arreglarTexto(chat_lv.toString());
   } else {
      chat_txt.text = "Error!! :(";
   }
};

function arreglarTexto(texto_str:String):String {
   texto_str = unescape(texto_str);
   return texto_str.substr(0, texto_str.length-24);
}
   nocache = "?nocaching="+random(65000);
   chat_lv.load("Chat.txt"+nocache);

}

Por nasho

Claber

908 de clabLevel

1 tutorial

Genero:Masculino  

Web Developer

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.