onConnectAccept()

application.onConnect = function (clientObj, username) {}
trace ("a client connected:" + username);
application.acceptConnection (clientObj);
};
application.onConnectAccept = {function (clientObj)}
trace ("connection accepted");
}

I also tried: this.acceptConnection (clientObj);

I have this script. When I connect, I get the first trace but I don't get the second track... then onConnectAccept() is not called? do not know how

Anyone got tips on this function does not work why?

V8 Flash swf, FMS2 server.

onConnectAccept:

Event handler; called only when the components are used (i.e., when the components.asc script is loaded in your script on the server side) when NetConnection.connect() is called client-side and a client connects to an instance of the application. Use onConnectAccept to handle the result of a connection accepted in an application that contains the components.

...

In other words; If you don't use of components, you can not use this function.

Tags: Adobe Media Server

Similar Questions

  • a little duped on client.call

    Ive introduced a simple client-server application that seems to work for most. Only problem, is that the "client.call' in the application.onConnect does not call the function on the client.

    It's in my main.asc:
    ---------------------------------------------------------------------------------
    application.onConnect = function (client, name)
    {
    find available Identificateursuivant
    var i = 0;
    var tempObj = users_so.getProperty ("u" + i);
    While (tempObj! = null)
    {
    i ++ ;
    tempObj = users_so.getProperty ("u" + i);
    }

    Save the client object ID
    client.ID = "u" + i;

    Add the user to SO (this will trigger an onSync on clients)
    users_so. SetProperty (client.id, name); name
    users_so. SetProperty ("lastClient", name); name

    accept the connection
    application.acceptConnection (client); It works - onStatus is called with NetConnection.Connect.Success

    Tell the customer what is their identity card
    customer. Call ("setID", null, client.id); does not seem to do anything
    }
    ----------------------------------------------------------------------------------------

    and that is in my client:
    ----------------------------------------
    my_nc. SetID = function (id)
    {
    myID = id;
    statusInput.text += "online. Your id is "+ myID; is never executed
    };
    ---------------------------------------

    Even if the onStatus is called a 'success', the code client.call ("setID", null, client.id); does not call the customer setID function.

    And another question: what is client.id = "u" + i; Suppose what to do? Who establishes the id in a copy of the client on the server, or is it supposed to actually define a variable named 'id' on the real client? If Yes, then what is client.call ("setID", null, client.id); for?

    OK after a few hours of perusing the macromedia documentation, I found the solution. Because I do not 'components' use to manage the connection, the code in onConnect should be divided into two blocks.

    so now:

    application.onConnect = function (client, name)
    {
    accept the connection - it's the ONLY thing we are doing here.
    application.acceptConnection (client);
    }

    application.onConnectAccept = function (newClient, name)
    {
    all the rest do here regarding the installer for the client
    }

Maybe you are looking for