Comunidad de diseño web y desarrollo en internet online

Suceso EXTRAÑO con setCredentials

Citar            
MensajeEscrito el 24 Ene 2006 02:11 pm
Tenemos este código:

Código :

import mx.remoting.Service; 
import mx.services.Log; 
import mx.rpc.RelayResponder; 
import mx.rpc.FaultEvent; 
import mx.rpc.ResultEvent; 
import mx.remoting.PendingCall; 

var sSecured:Service = new Service("http://localhost/project/amfphp/gateway.php", null, "SecuredConn", null, null); 
mx.remoting.debug.NetDebug.initialize(sSecured);


function welcomeResult(rs:ResultEvent) { 
   trace(rs.result); 
} 

function welcomeFault(fl:FaultEvent) { 
   trace("Su usuario no esta validado"); 
   trace("Hubo un problema: "+fl.fault.faultstring); 
   trace("El código del error es: "+fl.fault.faultcode); 
   trace("Detalles: "+fl.fault.detail); 
} 


btnEntrar.onRelease = function() 
{
   sSecured.connection.setCredentials(tfUsuario.text,tfPassword.text); 
   var pcWelcome:PendingCall = sSecured.welcome(); 
   pcWelcome.responder = new RelayResponder(this, "welcomeResult","welcomeFault"); 
}



y este otro:

Código :

import mx.remoting.Service; 
import mx.services.Log; 
import mx.rpc.RelayResponder; 
import mx.rpc.FaultEvent; 
import mx.rpc.ResultEvent; 
import mx.remoting.PendingCall; 

var sSecured:Service = new Service("http://localhost/project/amfphp/gateway.php", null, "SecuredConn", null, null); 
mx.remoting.debug.NetDebug.initialize(sSecured);


function welcomeResult(rs:ResultEvent) { 
   trace(rs.result); 
} 
function welcomeFault(fl:FaultEvent) { 
   trace("Su usuario no esta validado"); 
   trace("Hubo un problema: "+fl.fault.faultstring); 
   trace("El código del error es: "+fl.fault.faultcode); 
   trace("Detalles: "+fl.fault.detail); 
} 

function checkForm()
{ 
   sSecured.connection.setCredentials(tfUsuario.text,tfPassword.text); 
   var pcWelcome:PendingCall = sSecured.welcome(); 
   pcWelcome.responder = new RelayResponder(this, "welcomeResult","welcomeFault"); 
} 

btnEntrar.onRelease = function() 
{
   checkForm();
}



Como podeis comprobar, la única diferencia es que en el segundo llama a la función "checkForm" para hacer lo mismo que en el primero. ¿Cómo es posible que el segundo haga el trace y el primero no? :?

Saludos! ^^

Por [Sheer]

Claber

283 de clabLevel

1 tutorial

Genero:Masculino  

Barcelona

opera
Citar            
MensajeEscrito el 24 Ene 2006 07:31 pm
este tiene un error

Código :

btnEntrar.onRelease = function() 
{ 
   sSecured.connection.setCredentials(tfUsuario.text,tfPassword.text); 
   var pcWelcome:PendingCall = sSecured.welcome(); 
   pcWelcome.responder = new RelayResponder(this, "welcomeResult","welcomeFault"); //<----en esta linea esta el error
}


fijate que estas poniendo this dentro del evento onRelease....lo que provoca que no punte correctamente al lugar donde estan las funciones de respuesta....(estas estan en la linea de tiempo)...

saludos!

Por tangamampilia

.GAIA Developer

961 de clabLevel


6 articulos

Genero:Masculino   Anime Bloggers

México, D.F.

safari
Citar            
MensajeEscrito el 24 Ene 2006 11:56 pm
Ahora lo entiendo. Lo bueno es que no es la primera vez que me lio con el tema de los niveles.

Saludos y gracias ^^

Por [Sheer]

Claber

283 de clabLevel

1 tutorial

Genero:Masculino  

Barcelona

opera

 

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