PDA

View Full Version : flash mx remoting set up


usmanlakhani
08-28-2005, 10:04 PM
I am a new person to this concept and have been trying to get an answer for this for ever .... could some one please help me ?


mx.remoting.Service.Service;

if (init == null) {
init = true;

gateway = "http://localhost/flashRemoting/gateway.aspx";
myConn = NetServices.createGatewayConnection(gateway);

service = "flashDotNet";
myServiceObject = myConn.getService(service, this);
}

btnGo.onRelease = function() {
myServiceObject.helloWorld();
}

// Invoked when helloworld function returns a result
function helloWorld_Result(result) {
tbMessage = result;
}

// Invoked when helloworld function returns an error
function helloWorld_Status(status) {
tbMessage = status.description;
}


i got so far and i dont have any errors in syntax but i dont have any output either ! i use MX 7.0 and i dont know which version of AS I use HELP PLEASE

usmanlakhani
08-28-2005, 10:38 PM
I just read the post for proper posting ettiquetes !

I am using .net and am trying to use mx 7.0 to connect to the server which is iis.

since i am using the "import mx.remoting ... " line i assume i am using AS 2.0.

PLEASE PLEASE help me !

i have been stuck for a while now !

klangdon
09-03-2005, 11:41 PM
Your two methods you are expecting to be seen called are never being designated to the service. You can do this by creating a RelayResponder or by setting them to the PendingCall.onResult and PendingCall.onFault. Below is an example of what you are trying to do using a RelayResponder:


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

// create RelayResponder to specify result handling methods
var responder:RelayResponder = new RelayResponder(this,"helloWorld_Result","helloWorld_Fault");

var service:Service = new Service("http://localhost/flashRemoting/gateway.aspx",
null,
"flashDotNet",
null,
responder);

// call service function
btnGo.onRelease = function() {
var pc:PendingCall = service.helloWorld();
}

// Invoked when helloworld function returns a result
function helloWorld_Result(result) {
tbMessage = result;
}

// Invoked when helloworld function returns an error
function helloWorld_Status(status) {
tbMessage = status.description;
}