Comunidad de diseño web y desarrollo en internet online

Esperando respuesta para recarga de datos

Citar            
MensajeEscrito el 27 Nov 2006 11:59 am
Hola a todos, os comento mi problema.

Tengo un swf que carga unas variables de un xml. Seguidamente trás pulsar un botón la pélicula vuelve al fotograma uno y recarga las variables del xml. El caso es que no llega a recargarlas. El sistema que he intentado utilizar es priermo enviar las variables (eso funciona) y luego me devuelve una variable "resultado" cuando el flash detecta el valor de true en resultado vuelve a recargar la pélicula. Os pongo el código. Seguramente he hecho una chapuza :P

Código :

var envio_lv:LoadVars = new LoadVars();
var recibir_lv:LoadVars = new LoadVars();
var listener:Object = new Object();
function envioVar(proxPos) {
   trace("enviando...");
   envio_lv.codigo = proxPos;
   envio_lv.sendAndLoad("gestion.php", recibir_lv, "POST");
}
mensaje_txt.html = true;
recibir_lv.onLoad = function(exito) {
   if (exito) {
      mensaje_txt.htmlText = "<b>Enviado con exito. Esperando respuesta.</b>";
      mensaje_txt_2.htmlText = recibir_lv.resultado;
      listener.onLoadInit = function(recibir_lv:LoadVars) {
         if (recibir_lv.resultado == true) {
            gotoAndStop(1);
            trace("respuesta recibida");
         } else {
            mensaje_txt.htmlText = "<b>No ha recibido variable resultado</b>";
         }
      };
   } else {
      mensaje_txt.htmlText = "<b> No enviado</b>";
   }
};

Por ynosh

11 de clabLevel



 

msie
Citar            
MensajeEscrito el 27 Nov 2006 12:58 pm
He probado también este método pero sigue sin funcionar:

Código :

var envio_lv:LoadVars = new LoadVars();
var recibir_lv:LoadVars = new LoadVars();
function envioVar(proxPos) {
   trace("enviando...");
   envio_lv.codigo = proxPos;
   trace(proxPos);
   envio_lv.sendAndLoad("gestion.php", recibir_lv, "POST");
}
mensaje_txt.html = true;
recibir_lv.onLoad = function(exito) {
   if (exito) {
      mensaje_txt.htmlText = "<b>Enviado con exito. Esperando respuesta.</b>";
      mensaje_txt_2.htmlText = recibir_lv.resultado;
      recibir_Interval = setInterval(recargaMapa, 1);
      function recargaMapa() {
         
         if (recibir_lv.resultado == true) {
            gotoAndStop(1);
            mensaje_txt.htmlText = "<b>Respuesta recibida.</b>";
            trace("respuesta recibida");
            clearInterval(recibir_Interval);
         } else {
            trace ("esperando")
            mensaje_txt.htmlText = "<b>No ha recibido variable resultado</b>";
         }
      }
   } else {
      mensaje_txt.htmlText = "<b> No enviadob>";
   }
};

Por ynosh

11 de clabLevel



 

msie

 

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