A communication application run for the first time creates an application instance on the server. In Chapter 3, "STEP 3: Get Connected," you created the myFirstApp folder within the flashcom/applications folder; this is your starting point. This folder provides the server with a location to store its resources that are persistent in your application. These persistent resources can include SharedObjects or recorded video. SharedObjects store data such as chat logs, connection information, or database information. The folder is also a location to store any recorded video your application requires. The folder should be considered a collection of resources the server needs for an application.
The application instance is stored in server memory and is created when an application first runs or is manually "instanced" through the App Inspector. On first execution, the server executes the file main.asc or a file matching the name of the application. In our example, the server looked to run main.asc; if that had not been found, it then would have looked for a file called myFirstApp.asc. It is your decision how you want to name your initial file. There is really no benefit for using one or the other.
These files contain server-side ActionScript (SSAS). ActionScript methods and objects required for the successful operation of a communication application are declared in these files. The server reads this file and parses it through its ActionScript interpreter storing the functions in memory and executing any commands. ASC files are, in essence, compiled (or published) into the server RAM.
The main.asc file you created contained a single ActionScript command:
This command loaded a series of server-side objects required by your myFirstApp movie. The objects included the ActionScript objects used by the Communication UI components. You actually see them load when you explore the App Inspector. Flash components, like SimpleConnect, Chat, and AVPresence, had their server-side counterpart scripts loaded into server memory, ready to be accessed by any Flash Player 6 loaded with your application. The components.asc file can be viewed from the flashcomm/ScriptLib folder. The ScriptLib folder is a special folder that has a virtual mapping inside your application. Chapter 14, "Server Administration," will review the uniqueness of the ScriptLib folder.
Any changes made to server-side (ASC) files require the application to be reloaded. The reload process is important to become familiar with after you start developing server-side ActionScript. The Administration Console and the App Inspector will help you manage and monitor these application instances. They also provide tools for loading and unloading the applications.