Components and the ScriptLib Folder
The ScriptLib folder contains libraries that extend the native Flash Communication Server objects. This folder is installed outside the Applications folder on your server because it can be shared between all applications, adaptors, and virtual hosts. These will be presented later in Chapter 14, "Server Administration."
Two groups of libraries are shipped with the Flash Communication Server. The Components library includes the required server-side logic for the Flash UI components. This library must be loaded before you can use the components. The second library is the NetServices library, which is required if you plan to connect with external application servers using Flash Remoting MX. The library contains two primary classes. NetServices handles Flash Remoting MX connections, and RecordSet is an advanced object that operates as a standard database query object. Flash Remoting is presented in detail in Chapter 13, "Accessing External Data."
In every exercise you have done, the file components.asc was loaded into main.asc. This file is a controller file that loads a collection of classes required by the Flash UI components. Each UI component has a class defining the server-side methods, properties, and events. These files exist inside the ScriptLib/components folder. You can alter these files; however, it is not recommended. If you must modify methods, copy the prototype function from the component class file and overwrite it in your main.asc file. Doing this ensures that you do not corrupt the component class or affect any other applications on the server. If you change anything within the ScriptLib folder, you run the risk of corrupting not only the component for this instance, but for every application running within that virtual host.
The ScriptLib folder is where the server looks for files that are not found in your application folder. You can change the location of this folder by modifying the Application.xml file within the folder:
Look for the following entry:
You can add more ScriptLibPaths to the Application.xml file by separating them with a semicolon (;). The server looks for files first in your application folder, and then from left to right in this ScriptLibPath list. You can also place files within the ScriptLibPath that you want accessible by all applications. For security reasons, be careful what you place in hereyou wouldn't want other applications accessing custom classes they shouldn't.