Specifications
CHAPTER 2
22
For shared MXML and ActionScript files that are outside of the application’s directory structure, you modify the
source path to include the directories that the compiler searches for MXML and ActionScript files. The
component search order in the source path is based on the order of the directories listed in the source path.
You can set the source path as part of configuring your project in Flex Builder, in the flex-config.xml file, or set it
when you open the command-line compiler. In this example, you set the source path to:
C:\myApps\sharedLibrary
To access a component in an MXML file, you specify a namespace definition that defines the directory location
of the component relative to the source path. In the following example, an MXML file in the appRoot1 directory
accesses an MXML component in the local directory structure, and in the directory containing the shared library
of components:
<?xml version="1.0"?>
<!-- apparch/ComponentNamespaces.mxml -->
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyLocalComps="myFormatters.*"
xmlns:MySharedComps="sharedFormatters.*"
>
<MyLocalComps:PriceFormatter/>
<MySharedComps:SharedFormatter2/>
</mx:Application>
The MXML tag name for a custom component is composed of two parts: the namespace prefix, in this example
MyLocalComps and MySharedComps, and the tag name. The namespace prefix tells Flex the directory in the
source path that contains the file that implements the custom component. The tag name corresponds to the
filename of the component, in this example PriceFormatter.mxml and SharedFormatter2.mxml.
Using a SWC file in a Flex SDK application
A SWC file is a Flex library file that contains one or more components implemented in MXML or ActionScript.
All Flex library files are shipped as SWC files in the frameworks/libs directory. This includes the following SWC
files:
• framework.swc
• playerglobal.swc
• rpc.swc










