Skip to main content
Participant
Mar 23, 2010 3:11 AM UTC
Question

client.call() and responder question

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 is closed to new replies. Start a new post to keep the conversation going.

    2 replies

    Adobe Employee
    Mar 23, 2010 10:23 AM UTC

    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()

    Translate
    mmeccaAuthor
    Participant
    Mar 24, 2010 7:08 PM UTC

    Thanks so much. This was really helpful.

    Translate