View Full Version : Calling a method of application from client-side script - how ?

02-10-2005, 09:01 AM
I know there is the NetConnection.call(...) method, but it calls a method of Client class instance, not the Application on the server side. The reason I dont want to have a Client method, is simply code clarity. I dont really need to distinguish the client, i simply want to remote-call a server Application method. I tried .call("/some_method") and call("application/some_method") but apparently neither work...

02-12-2005, 11:40 AM
You have to declare class method on the Server side.

application.onConnect = function(pClient) {


pClient.msgFromClient = function(msg) {


On client side, after connection, you can call your new method msgFromClient.

nc.call("msgFromClient", null, "Hello!");

02-15-2005, 12:32 PM
Thank you, but your answer is more or less useless (if I may be so rude). I know how to call a Client method, it is not a big deal. What I dont know is how to remote call an "application" method.

Pardon if I was rude, i just had the impression that you spent a lot of time writing your post, and all that I knew already.

P.S. It is faster to use Client.prototype.msgFromClient = function ... than having to assign an instance member (as opposed to prototype or class member) on every new connected client. Just a hint.

02-16-2005, 06:41 AM
I do not know this concept in depth. I am searching over one week to learn. I think by object terminology, to call an application method you need instance of application on the client side. Maybe passing application object to client swf will work. But i do not think so that will happen. Because in security terms it is not appreciated to expose core application object. It is worth to try.

What is the draw back of calling client method defined in FCS. Why do you need an application method?