Sorry guys but it still doesn't appear to be working. I am getting no message in my FMS admin console.The function i believe is called correctly. However, im getting nothing back...
I show you both my Client-Side and Server-Side code and see if you can identify any errors.
Client-Side
var nc:NetConnection = new NetConnection();
nc.connect("rtmfp://fms/example program");
nc.addEventListener(NetStatusEvent.NET_STATUS, netHandler);
function netHandler(Event:NetStatusEvent):void{
switch(event.info.code):void{
trace("Connected up");
break;
var my_ro:SharedObject = SharedObject.getRemote("myMsg", nc.uri, false);
my_ro.connect(nc);
var responder:Responder = new Responder(function(result):void{trace('ok :', result);},
function (status):void{trace('status :', status);});
nc.call("sendMessage", responder, "myTest was called");
Server-Side
application.onConnect = function(clientObj){
//Accept the client
this.acceptConnection(clientObj);
}
client.sendMessage = function(msg){
trace("calling the test on the server");
return msg;
}
Hi,
You should call the NetConnection.call() function after receiving NetConnection.Connect.Success. Also, the server side code's syntax is not correct. You must be getting error in the server side application log. You can modify your code like following:
Client side:
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, netHandler);
nc.connect("rtmfp://fms/test");
function netHandler(event:NetStatusEvent):void {
trace("In onNc "+event.info.code);
if(event.info.code === 'NetConnection.Connect.Success') {
var responder:Responder = new Responder(function (result):void{trace('ok :', result);},function (status):void{trace('status :', status);});
nc.call("sendMessage", responder, "myTest was called");
}
}
Server Side:
application.onConnect = function(clientObj)
{
trace("In onConnect");
this.acceptConnection(clientObj);
clientObj.sendMessage = sendMessage;
}
function sendMessage(msg){
trace("calling the test on the server");
return msg;
}