Using Communication Objects > Application object > Application.onConnectAccept and application.onConnectReject |
![]() ![]() ![]() |
Application.onConnectAccept and application.onConnectReject
When you use components in your application, it's good to be aware that components introduce explicit onConnectAccept and onConnectReject events. You need to include code to handle these events. Any time you use components, you need to modify the application.onConnect
statement in your server-side code to include the application.onConnectAccept
and application.onConnectReject
event handlers, which are unique to the components. The last line (in order of execution) of your onConnect method should be either application.acceptConnection
or application.rejectConnection
. If your application requires additional code following the explicit acceptConnection or rejectConnection, such as a message indicating that the user has been granted or denied permission to the application, place that code in the application.onConnectAccept
or application.onConnectReject
statements.
Tip: If you're not using communication components, you cannot use application.onConnectAccept and application.onConnectReject.
Each component can have its own application.onConnect
method. By using onConnectAccept and onConnectReject, you can customize a component or create a new one to implement authentication; for example, the code in a component could query a database and decide to accept or reject a user based on the user name and password stored in the database.
For more information about application.onConnectAccept
and application.onConnectReject
, see the Server-Side Communication ActionScript Dictionary.
![]() ![]() ![]() |