Using Communication Components > Using the SimpleConnect component > Without the SimpleConnect component |
![]() ![]() ![]() |
Without the SimpleConnect component
For most communication components to function properly, if you do not use the SimpleConnect component, you must add the following line of code to your server-side application.onConnect
method to successfully register the user name with the server:
gFrameworkFC.getClientGlobals(newClient).username = newUserName;
As described in the Server-Side Communication ActionScript Dictionary, whenever you create an onConnect
method, you must explicitly accept the new client's connection.
If you don't use the SimpleConnect component, your server-side script file (main.asc or app_name.asc) file must include the following lines of code:
load("components.asc"); // Listen for the new connection to this application. // newUserName is a parameter passed in from the client-side nc.connect call. application.onConnect = function(newClient, newUserName) { // Set the global user name with the user name passed into this function. gFrameworkFC.getClientGlobals(newClient).username = newUserName; // Accept the connection from the user. application.acceptConnection(newClient);} // Note that if your application requires additional code following the // explicit acceptConnection, you must place that code in an // application.onConnectAccept statement (required when using components)
Tip: For more information on onConnectAccept and onConnectReject statements and using them with communication components, see Application object.
![]() ![]() ![]() |