Skip to main content
Participant
May 24, 2007
Question

Client."commandName" trouble

  • May 24, 2007
  • 9 replies
  • 558 views
I seem to be having trouble with what should be simple remote AS calls. Nothing I've tried has worked and I've followed the models provided in the Adobe documentation.

My server script consists of this:
application.onConnect (client, other params) {
...
client.FunctionName = function () {
trace ("This should be working");
}
...
}

My client side is this:
ncObject.call("FunctionName",null);

Anyone else had similar problems or see something dumb I'm missing?
    This topic is closed to new replies. Start a new post to keep the conversation going.

    9 replies

    jmellenAuthor
    Participant
    May 25, 2007
    Alas, no luck. I tried creating a prototype but it too does not get called.

    The response object also neverr gets called or returns a status message.

    Thanks for the suggestions though.
    May 25, 2007
    > The response object also neverr gets called or returns a status message.

    That's pretty strange. Is this your server or are you using a hosting solution(like influxis.com)? It seems you are doing everything right, so I have to wonder if something strange is going on with your server configuration. Sorry I couldn't help.
    jmellenAuthor
    Participant
    May 24, 2007
    Here is my server code:
    application.onConnect = function (client, username, position,
    firstName, lastName) {
    application.acceptConnection(client);
    client.recordStart = function () {
    trace ("Record Start");
    };
    }

    and my client code:
    cfPresentation.cfNCLive.call("recordStart",null);

    The actual program is huge but cfPresentation.cfNCLive is my NetConnection.

    I'm not currently passing a result object but I've tried that in the past and it hasn't returned anything.
    May 24, 2007
    That looks okay to me, but I'm not that experienced with FMS. Two things, though:

    1) Try assigning the function to the Client prototype(outside your application functions/events) instead of directly on the client.
    Client.prototype.recordStart = function () {
    trace ("Record Start");
    };

    2) By response object, I mean see what onStatus gives you:
    var resultObj = {};
    resultObj.onStatus = function(info){
    trace(info.code);
    }
    cfPresentation.cfNCLive.call("recordStart",resultObj);
    May 24, 2007
    > That was a typo when entering my example code.
    Ah, I should have guessed by the "oher params" argument, but at any rate, please copy paste your actual code.

    What does the resultObject on the server give you?
    jmellenAuthor
    Participant
    May 24, 2007
    This call comes well after the program has confirmed a connection.
    May 24, 2007
    If you are not receiving any errors when the application connects, when are you calling the function? Is it before you receive the Connect.Success? If so, then the function call will not execute since the client was not accepted.

    Use an onStatus event handler to call the function.

    __nc = new NetConnection();
    __nc.onStatus = function(info){
    switch(info.code){
    case "NetConnection.Connect.Success" :
    __nc.call("FunctionName", null);
    break;
    }
    }
    __nc.connect("rtmp://myconnection.com")

    Regards,
    Shack
    jmellenAuthor
    Participant
    May 24, 2007
    Ooops.

    That was a typo when entering my example code. My actual program does not have that error.
    May 24, 2007
    Well, for one thing, you have a syntax error:
    application.onConnect (client, other params) {
    should be:
    application.onConnect = function(client, other params) {

    Check your application logs. It should give you syntax errors like this.