In some cases, you use modules that are not in your main application's project. You might have the module in a separate project so that you can use custom configuration options, or you might want to share the module across multiple applications. You must add the module's source code to your application's source path and then add the module to the application's module list before you can use it in your project.
Add an already-compiled module to your project
- Select the main application in the navigator.
- Select Project > Properties > Flex Build Path to add the module's source to the application project's source path.
- Click the Add Folder button and browse to the module's source path. Click OK to select the module. You must do this for each external module that you add to your application's project.
- Click OK again to save your changes.
- Click Project > Properties > Flex Modules to add the module to the application's module list. The Flex Modules dialog box lists all modules that have been added to the current project or that are in the current project. When you first create a project, this dialog box is empty.
- Click the Add button. The Add Module dialog box appears.
- Use the Browse button or enter the location of the module's MXML file in the Source text box. All modules that are in the project's source path are available to add by using this dialog box.
- Select one of the radio buttons under Module SWF Size to enable or disable module optimization. If you select Optimize for Application, Flex Builder compiles the module against the selected application and excludes all classes that are defined in the main application. These can include framework classes or custom classes. When you select this option, you cannot use the same module in another application, because the list of excluded classes might be different. For more information, see Optimizing modules in Flex Builder.
- Click OK to save your changes. Flex Builder adds the module to the list of available modules in your application's project.