Macromedia flex 2 Manual

Page of 254
72
Compiling Components
</mx:Application>
When you distribute SWC files, ensure that the corresponding ActionScript file is not in the 
directory structure of the application or in the ActionScript classpath. Otherwise, Flex might 
use the ActionScript file, rather than the SWC file.
When you use mxmlc to compile the main application, ensure that the c:\flex\mainApp 
directory is included in the library path, otherwise mxmlc cannot locate the SWC file. 
For more information about SWC files, see Chapter 9, “Using the Flex Compilers,” in Building and Deploying Flex 2 Applications, and Chapter 10, “Building Projects,” in Using Flex 
Builder 2
Distributing a component as an RSL file
You create an RSL by using the compc tool, and then pass the library’s location to the 
compiler when you compile your application. For more information, including an example, 
see Chapter 10, “Using Runtime Shared Libraries,” in Building and Deploying Flex 2 
Applications
.
Compiling components with Flex Data 
Services
If you have Adobe® Flex™ Data Services, you can compile your application, and any custom 
components, in the same way that you can when using Flex 2 SDK. For more information, 
see 
. Alternatively, you can deploy 
your application on your application server, and then compile the application upon an HTTP 
request. 
To deploy the application on your application server, copy the MXML and ActionScript files 
to a web application directory. The first time a user requests the MXML file URL in a web 
browser, the server compiles the MXML code into a SWF file. The server then sends the SWF 
file to the web browser where it is rendered in Flash® Player. Unless the MXML or 
ActionScript file changes, the SWF file is not recompiled on subsequent requests. 
Typically, you copy these components to a subdirectory of the WEB-INF directory for the 
web application that corresponds to your Flex Data Services application. For example, you 
can copy custom ActionScript classes and MXML components to the WEB-
INF/flex/user_classesdirectory.