is it a scoping issue? maybe trying delegating the click to a function
in the same scope as the service...

sendMessage.click = Delegate.create(this, onButtonClick)

function onButtonClick() {
   pc = smsFlashRemoting.SendMessage(siteID, LicenseKey);
   pc.responder = new RelayResponder(this, 'SendMessage_Result',
'SendMessage_Fault');
}

On 7/7/06, Graham Pearson <[EMAIL PROTECTED]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am having an issue with flash remoting and would like to understand
what is going on so I can resolve this issue. The code below works
with the proper results.

import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;
import mx.remoting.debug.*;
import mx.rpc.*;
import mx.services.Log;
import mx.controls.Alert;

var siteID:String = "1000";
var gatewayServer:String = "messagegateway.localhost";
var LicenseKey:String = "7A14A28C";
var pc:PendingCall;

var smsFlashRemoting:Service = new Service("http://"; + gatewayServer +
"/flashservices/gateway", webServiceLog,
"properties.cfc.SMSMessageGateway", null, null);
pc = smsFlashRemoting.SendMessage(siteID, LicenseKey);
pc.responder = new RelayResponder(this, 'SendMessage_Result',
'SendMessage_Fault');

function SendMessage_Result(re:ResultEvent):Void {
    trace("Received Result from sendMessage_Result: " + re.result);
}

function SendMessage_Fault(fe:FaultEvent):Void {
    trace("Received Error from sendMessage_Fault: " +
fe.fault.faultstring);
}

As mentioned above this code works as I get the trace statement in the
output window which is what I would expect. Now for the code which
follows I will not get the trace statement from the _result function
and the only thing that I have done is put a button on a stage to have
the user click this button to run the same Remoting Call. Below is my
code:

import mx.remoting.Service; // Import the Service Class
import mx.remoting.PendingCall; // Import the PendingCall Class
import mx.remoting.RecordSet; // Import the RecordSet Class
import mx.remoting.debug.*; // Import the Remoting Debug Class
import mx.rpc.*; // Import all of the RPC Service Classes
import mx.services.Log;
import mx.controls.Alert;

var siteID:String = "1000";
var gatewayServer:String = "messagegateway.localhost";
var LicenseKey:String = "7A14A28C";
var pc:PendingCall;

var sendMessage = new Object();
var ccObjectListener = new Object();
var webServiceLog = new Log(Log.VERBOSE);
sendMessage_btn.addEventListener("click", sendMessage);

var smsFlashRemoting:Service = new Service("http://"; + gatewayServer +
"/flashservices/gateway", webServiceLog,
"properties.cfc.SMSMessageGateway", null, null);

sendMessage.click = function() {
pc = smsFlashRemoting.SendMessage(siteID, LicenseKey);
pc.responder = new RelayResponder(this, 'SendMessage_Result',
'SendMessage_Fault');

function SendMessage_Result(re:ResultEvent):Void {
    trace("Received Result from sendMessage_Result: " + re.result);
}

function SendMessage_Fault(fe:FaultEvent):Void {
    trace("Received Error from sendMessage_Fault: " +
fe.fault.faultstring);
}

}

The code with the button on the screen will never put the trace line
in the debug window. I have tried putting the fucntions for the
_Result and _Fault inside of the click function and also on the
outside. Everything that I have tried will reproduce the same results
without the trace being displayed in the output window.

Any Suggestions.

- --
Graham Pearson, System 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.1 (MingW32)
Comment: GnuPT 2.6.2.1 by EQUIPMENTE.DE
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFErnjArwdok4nP6d0RAvUuAJ9JcFGw1e2cGhKYKreEiLVXbqjzkgCdFK8o
hE9UiqliR3vhGhOZR/QM2vA=
=g7mS
-----END PGP SIGNATURE-----

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

Reply via email to