User Guide

70 Compiling Components
import mx.formatters.Formatter
public class MySimpleFormatter extends Formatter {
...
}
}
In this example, the MySimpleFormatter.as file is located in the
myComponents/formatter subdirectory of the main application directory. You map the
myComponents.formatters namespace to the
MyComp prefix, as the following example
shows:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.formatters.*">
<MyComp:MySimpleFormatter/>
</mx:Application>
If multiple files with the same name exist under an ActionScript classpath subdirectory
and the application subdirectory, Flex uses the file under the application subdirectory.
If you store the formatter component in a subdirectory of the ActionScript classpath
directory, you specify that subdirectory as part of the
package statement, as the following
example shows:
package flexSharedRoot.custom.components
{
//Import base Formatter class.
import mx.formatters.Formatter
public class MySimpleFormatter extends Formatter {
...
}
}
You then use a namespace that specifies the subdirectory. The following code declares a
component that is in the flexSharedRoot/custom/components directory:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="flexSharedRoot.custom.components.*"/>
<MyComp:MySimpleFormatter/>
</mx:Application>
If the same file exists in the ActionScript classpath directory and the application directory,
Flex uses the file in the application file directory.