Skip to main content
Participant
March 23, 2010
Question

client.call() and responder question

  • March 23, 2010
  • 1 reply
  • 425 views

I'm trying to create an application where my client (swf client) calls the server (creates a connection). then I want the server to call a url to load some xml data. When that data gets loaded, I want a response to go back to my swf client. Some of what I'm doing works, but I've had trouble stringing it all together.

1. new netConnection() -- all good

2. (server) acceptConnection -- all good

3. (server) client.xmlLoad -- all good

4. swf client... waiting ... waiting...but no one calls.

I set up a responder

nc.call ("loadXML",responder,"somedata");

and magically, the responder callback method fires. but seemingly on its own. My server side script is not making any returns. and it's not getting any data.

can someone respond with some basics of how things should be set up? I'm not sure how to call the swf client from within the xml.onLoad() method, which is when I know for certain that my xml request has finished processing.

    This topic has been closed for replies.

    1 reply

    Adobe Employee
    March 23, 2010

    The responder callback function will be called the moment "loadXML" finishes execution.

    To ensure that response is send to client only when xml data is loaded, you will have to call a function on client from server from inside xml.onLoad() method.

    Define a function on client,

    //assuming you are using as3 it will look like

    nc.client = new Object();

    nc.client.loadXMLSuccess = function(param) {}

    on server, in xml.onLoad() you will call something like,

    pClient.call("loadXMLSuccess",null,param);

    here pClient is the same client object that you used when accepting connection. You will have to keep a reference of the same in order to access in xml.onLoad()

    mmeccaAuthor
    Participant
    March 24, 2010

    Thanks so much. This was really helpful.