Next Page

Page: 1

Previous Page

Thread: flex fms client side( call back) function

Created on: 11/27/07 07:28 PM

Replies: 5

yogi4yu





Joined: 11/27/07

Posts: 25

flex fms client side( call back) function
11/27/07 7:28 PM

Hi all,
I am trying to recreate a very simple FMS application. I am refering to a tutorial provided at
http://www.dmu.com/flashcom/fc3.html

I know that FMS2 server side uses old as syntax but how to write this function in AS3/flex?

//Function the server calls to send message back to this client.
client_nc.msgFromSrvr=function(msgr){

var msgr;
_root.msg.text = msgr;
}

the server side main.asc is having this invocation

var msg = "Hello! You are connected as: " + newClient.name;
//Call the client function and pass it the msg

newClient.call("msgFromSrvr", false, msg);

what additional things to be changed now to port to flex ?

Link | Top | Bottom

yogi4yu





Joined: 11/27/07

Posts: 25

RE: flex fms client side( call back) function
11/27/07 7:32 PM

I have tried this
public function msgFromSrvr(msgr:String):void
{
Alert.show(" server is calling ");
chat_log.text = msgr;
}

and i do this
nc = new NetConnection();
nc.client = this;

But it is not working

Link | Top | Bottom

WizKeeD





Joined: 03/26/09

Posts: 16

RE: flex fms client side( call back) function
04/08/09 2:45 AM

I am also having trouble knowing how to design the function so i can call it from the server side in as3...the way it's done in the tut with as2 is pretty neat and similar to the ssas code, but i don't know how to convert that to as3.I think mostly atatch the function to the neconnection object so it can be called by the server-side...i honestly dunno

Link | Top | Bottom

WizKeeD





Joined: 03/26/09

Posts: 16

RE: flex fms client side( call back) function
04/08/09 4:48 AM

After a little bit of documentation i found the solution and i figured it was fair enough to come back and report...the code is just like in as2 where you define the function on the NetConnection object (ns.customFunction = function() {do stuff}) but in as3 you do it on the client object nc.client.customfunction = function() {do stuff} but do note that before you do this you must define the object so: "nc.client = new Object()" otherwise it will misfire. Hope that helped and anyone is invited to clear up this jumpled up explanation into proper terms, i just gave out the raw solution :P

Link | Top | Bottom

Graeme



Graeme's Gravatar

Joined: 10/18/07

Posts: 1114

RE: flex fms client side( call back) function
04/08/09 12:27 PM

I'm pretty sure this tutorial: http://www.fmsguru.com/showtutorial.cfm?tutorialID=22 covers that. Thanks for posting back with your results, great to see.

Link | Top | Bottom

kjeske





Joined: 04/04/09

Posts: 16

RE: flex fms client side( call back) function
04/08/09 2:23 PM

in as3 you can also do nc.client = this
and just define functions in your class...

Link | Top | Bottom

New Post

Please login to post a response.