Macromedia flash media server 2-developing media applications User Manual

Page of 114
86
Application Development Tips and Tricks
On the server side, you must implement slightly different code; server-side ActionScript does 
not contain a global object. The following code includes a file called my_file.asc:
if (_my_file_asc == null) {
_my_file_asc = true;
// All the code for myfile.asc goes here.
}
Also, instead of using the 
#include
 command, the server-side script uses a 
load
 command, as 
follows: 
load("my_file.asc");
Archiving and compiling server-side 
script files
Flash Media Server includes a command-line archive compiler utility (far.exe) that lets you 
package all your server-side scripts into one archive file, much like a ZIP file, to simplify 
deployment. You can also use the archive compiler utility (called FAR) to compile server-side 
script files to bytecode (with the file extension .ase) to speed up the time required to load an 
application instance. 
Archiving server-side scripts
A large application can contain multiple server-side script files stored in different locations. 
Some files are located in the application directory and others are scattered in the script library 
paths that are defined in the server configuration file. To simplify deployment of your media 
application, you can package your server-side .js, .asc, and .ase files in a self-contained Flash 
Media Server Archive file (.far). 
The FAR file is a package that includes the main script file (which is either main.js, main.asc, 
main.ase, <appname>.js, <appname>.asc, or <appname>.ase) and any other script files that are 
referred to in the main script.