This may be a scoping problem,
As you define your result handling function inside your clic handler. You
could try this :
import mx.utils.Delegate;
// your usual code here
createAccount.click = Delegate.create(this, clickHandler);
function clickHandler() {
var checkUsername_pc:PendingCall =
FlashChat.CheckUsername(username_txt.text);
var checkUsername_res:RelayResponder = new RelayResponder(this,
"CheckUsernameResult", "CheckUsernameFault"); // btw you had twice the same
var name here checkUserName_pc for PendinCall and Responder
}
function CheckUsernameResult(msg) {
trace("--> CheckUsernameResult was " + msg);
}
function CheckUsernameFault(msg) {
trace("--> CheckUsernameFault was " + msg);
}
HTH
A.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Graham
Pearson
Sent: 24 novembre 2006 10:05
To: Flashcoders mailing list
Subject: Re: [Flashcoders] AS2 Flash Remoting Troubles
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Here is my entire code which I am having issues with:
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.services.Log;
var gatewayServer:String = "devel.yourcfpro.com"; var webServiceLog = new
Log(Log.VERBOSE); var createAccount = new Object();
createAccount_btn.addEventListener("click", createAccount);
CheckSO();
var FlashChat:Service = new Service("http://" + gatewayServer +
"/flashservices/gateway", webServiceLog, "properties.cfc.flashchat", null,
null);
createAccount.click = function() {
var checkUsername_pc:PendingCall =
FlashChat.CheckUsername(username_txt.text);
var checkUsername_pc:RelayResponder = new RelayResponder(this,
"CheckUsernameResult", "CheckUsernameFault");
function CheckUsernameResult(msg) {
trace("--> CheckUsernameResult was " + msg);
}
function CheckUsernameFault(msg) {
trace("--> CheckUsernameFault was " + msg);
}
}
webServiceLog.onLog = function(txt) {
trace(txt);
}
stop();
Which produces the following in the Debug Window:
11/25 10:2:18 [INFO] : Creating Service for properties.cfc.flashchat
11/25 10:2:18 [INFO] : Creating gateway connection for
http://devel.yourcfpro.com/flashservices/gateway
11/25 10:2:18 [INFO] : Successfully created Service
11/25 10:2:23 [INFO] : Invoking CheckUsername on properties.cfc.flashchat
11/25 10:2:25 [INFO] : properties.cfc.flashchat.CheckUsername() returned
true
Graham Pearson wrote:
> I am working on moving my AS1 Flash Remoting Applications over to AS2
> and having a devil of a time. The problem that I am running into is
> that the code within the RelayResponder does not execute to my knowledge.
> Here is an example of what I am doing.
>
> function onEchoFault(rs:FaultEvent) {
> trace("--> onEchoFault has been executed "); } function
> onEchoResult(re:ResultEvent) { trace("--> onEchoResult has been
> executed "); }
>
> var pc:PendingCall = myService.makeEcho("Hello World!"); pc.responder
> = new RelayResponder(this, "onEchoResul", "onEchoFault");
>
>
> When I run the application in my debugger window I get the following
>
>
> 11/25 7:26:11 [INFO] logger1: Creating Service for
> properties.cfc.HelloWorld
> 11/25 7:26:11 [INFO] logger1: Creating gateway connection for
> http://devel.yourcfpro.com/flashservices/gateway
> 11/25 7:26:11 [INFO] logger1: Successfully created Service
> 11/25 7:26:13 [INFO] logger1: Invoking makeEcho on
> properties.cfc.HelloWorld
> 11/25 7:26:15 [INFO] logger1: properties.cfc.HelloWorld.makeEcho()
> returned "Hello Hello World!"
>
> I do not get the Trace statement on the onEchoResult. What am I doing
wrong.
>
>
- --
Graham Pearson, System Administrator / DCG Administrator / Application
Developer Northern Indiana Educational Services Center Mishawaka, IN 46544
Voice (866) 254-5322 or (574) 254-5210 / Fax (574) 254-0148 -----BEGIN PGP
SIGNATURE-----
Version: GnuPG v1.4.4 (MingW32)
Comment: GnuPT 2.6.2.1 by EQUIPMENTE.DE
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFZwoKakuGrBT7wfkRAkBzAKDlD9fomYFZPT40EyqZvSvMBa36mwCgsWfW
DXv449oid5YtjdZh5HgoEHA=
=BBwv
-----END PGP SIGNATURE-----
--
This message has been scanned for viruses and dangerous content by our Email
Filtering System and is believed to be clean.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.14/548 - Release Date: 2006-11-23
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.14/548 - Release Date: 2006-11-23
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com