Skip to main content
Participant
April 28, 2010
Question

How to call methos form server to client

  • April 28, 2010
  • 1 reply
  • 680 views

Hello Friends

                   I m working in flex3.0 and i just want to know that how can i call a function from fms server to my AS3.0 (Client Side) code.

i tried the syntax client.call(methodname,null,null); but my flex code throw exception unable to call the method.

here can i use clientobject.call(methodname,null,null) and is there some special way to declare that method at client side.

can anyone put some demo code of both server side as well as client side so that i can undersatnd it properly.

Thanks and regards

  Vineet osho

    This topic has been closed for replies.

    1 reply

    April 28, 2010

    Hi,

    You can try it the following way. On client side define the function on the netconnection object as

    nc = new NetConnection();

    nc.connect("rtmp://server-ip/app");

    nc.client = new Object();

    nc.client.someMethod = function(msg) {

    //logic here

    trace(msg);

    }

    On the server side you can use

    clientObj.call("someMethod",null,"Hello");

    I think this should get you some idea. However if you need more info or still run into issues please revert back,

    Thanks,

    Abhishek

    Participant
    April 29, 2010

    Thanks abhishek its reply helpful.but i m using flex framework at   client side i mean working on as3

    and ur code

    nc  = new NetConnection();

    nc.connect("rtmp://server-ip/app");

    nc.client  = new Object();

    nc.client.someMethod  =  function(msg) {

    //logic  here

    trace(msg);

    }

    but i think this is as2 .0   code.

    is it mandatory to specify   the methodpath to server asu done in this client side code.

    waiting for your reply.

    thanks and regards

       Vineet osho

    April 29, 2010

    >>is it mandatory to specify the methodpath to server asu done in this client side code.

    I did not get this question clearly and I am not sure what you actually meant. Can you just explain this a little?

    The client side code that I ahe given you is an as3 code and it works on my end. What is the issue you faced on using this code? Did it give you some error or exception?