Questions like this:
if in my main.asc dont have application's onConnect method ,that only like load("components.asc"),so how could i add those code??
Means that you don't know the basis for script any app. So a reasonable approach is to read some book (the excellent Programmig Flash Communication Server http://www.amazon.co.uk/exec/obidos/ASIN/0596005040/qid%3D1109841551/ref%3Dsr%5F8%5Fxs%5Fap%5Fi1%5Fxgl//202-4113617-8853419#product-details
) of even the manual Server-Side Communication ActionScript Dictionary ( http://www.macromedia.com/support/documentation/en/flashcom/index.html#manuals
) In this same page you can find all FlashCom manuals.
Explaining things that are in the manual is booring. Here I quote all application Handlers that you can use in your asc file, and even more: in the manual are code snippets:
Event handler summary for the Application object
Event handler Description
Application.onAppStart Invoked when the application is loaded by the server.
Application.onAppStop Invoked when the application is unloaded by the server.
Application.onConnect Invoked when a client connects to the application.
Application.onConnectAccept Invoked when a client successfully connects to the application; for use
with communication components only.
Application.onConnectReject Invoked when a client fails to connect to the application; for use with
communication components only.
Application.onDisconnect Invoked when a client disconnects from the application.
Application.onStatus Invoked when a script generates an error.