Macromedia flex 2 Manuale

Pagina di 254
66
Compiling Components
An ActionScript component in a subdirectory of the main application directory must 
define a fully qualified package name that is relative to the location of the application’s 
root directory. For example, if you define a custom component in the 
dir1/dir2/myControls/PieChart.as file, its fully qualified package name must be 
dir1.dir2.myControls, assuming dir1 is an immediate subdirectory of the main 
application directory.
An MXML component does not include a package name definition. However, you must 
declare a namespace definition in the file that references the MXML component that 
corresponds to the directory location of the MXML component, either in a subdirectory 
of the application’s root directory, or in a subdirectory of the classpath. For more 
information, see 
An application can access MXML and ActionScript components in the directories 
included in the ActionScript classpath. The component search order in the classpath is 
based on the order of the directories listed in the classpath.
An ActionScript component in a subdirectory of a directory included in the classpath 
must define a fully qualified package name that is relative to the location of the classpath 
directory. For example, if you define a custom component in the file 
dir1/dir2/myControls/PieChart.as, and dir1 is included in the ActionScript classpath, its 
fully qualified package name must be dir1.dir2.myControls.
The 
<mx:Script>
 tag in the main MXML file, and in dependent MXML component 
files, can reference components located in the ActionScript classpath.
Compiling components with Flex 2 SDK
How you compile an application with Adobe® Flex™ SDK is based on how you distribute your 
custom components. This section describes how to compile an application that uses custom 
components distributed as MXML, ActionScript, SWC, and RSL files. 
Distributing components as MXML and 
ActionScript files
When you compile an application with Flex 2 SDK, you define where the MXML and 
ActionScript files for your custom components exist in the directory structure of your 
application, or in the directory structure of components shared by multiple applications.