Skip to main content
January 11, 2007
Answered

onConnectAccept()

  • January 11, 2007
  • 2 replies
  • 409 views
application.onConnect = function(clientObj, username){
trace("A client has connected: "+username);
application.acceptConnection(clientObj);
};
application.onConnectAccept = function(clientObj){
trace("Connection accepted");
}

I have also tried: this.acceptConnection(clientObj);

I have this script. When I connect, I get the first trace but I don't get the second trace... so onConnectAccept() is not being called? not sure how

Anyone got any tips on why this function doesn't run?

Flash v8 swf, server running FMS2.
    This topic has been closed for replies.
    Correct answer
    onConnectAccept :

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

    ...

    In other words ; if you don't use components you can't use this function.

    2 replies

    Correct answer
    January 12, 2007
    onConnectAccept :

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

    ...

    In other words ; if you don't use components you can't use this function.
    January 12, 2007
    Thanks for responding to my post. And thanks for explaining. :)
    Inspiring
    January 11, 2007
    Hello :)

    do you use a client swf with into a script who use the NetConnection
    class ???

    in Flash :

    var nc:NetConnection = new NetConnection() ;

    nc.onStatus = function (oInfo)
    {
    trace( oInfo.code + " : " + oInfo.status + " : " +
    oInfo.description ) ;
    }

    nc.connect("rtmp://localhost/yourApplication") ;

    // yourApplication is the directory in your applications/ directory in
    the FMS server with the main.asc !

    And when you launch the swf .... if you use the good rtmp url you must
    see in the FMS console the trace("Connection accepted") !!

    This event is only notify when a client try to connect on the application.

    EKA+ :)

    > application.onConnect = function(clientObj, username){
    > trace("A client has connected: "+username);
    > application.acceptConnection(clientObj);
    > };
    > application.onConnectAccept = function(clientObj){
    > trace("Connection accepted");
    > }
    >
    > I have also tried: this.acceptConnection(clientObj);
    >
    > I have this script. When I connect, I get the first trace but I don't get the
    > second trace... so onConnectAccept() is not being called? not sure how
    >
    > Anyone got any tips on why this function doesn't run?
    >
    > Flash v8 swf, server running FMS2.
    >