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.
Содержание FLEX 2 - CREATING AND EXTENDING COMPONENTS
Страница 1: ...Creating and Extending Flex 2 Components Adobe Flex 2...
Страница 6: ...6 Contents...
Страница 10: ...10 About Flex Documentation...
Страница 12: ......
Страница 24: ...24 Creating Flex Components...
Страница 74: ...74 Compiling Components...
Страница 76: ......
Страница 118: ...118 Creating Advanced MXML Components...
Страница 120: ......
Страница 182: ...182 Creating Advanced Visual Components in ActionScript...
Страница 194: ...194 Creating Custom Style Properties...
Страница 204: ...204 Creating Template Components...
Страница 206: ......
Страница 216: ...216 Creating Custom Formatters...
Страница 254: ...254 Index...