Search Flex Samples

Flex Managing projects

You use the Flex Navigator view to add and import resources into projects, export projects, and move and delete resources.

Setting Flex project properties

Each Flex project has its own set of properties. To set these properties, select the project in the Flex Navigator view. Then select Project > Properties from the main menu, or right-click (Control-click on Macintosh) to display the context menu and select Properties.

You can set the following project-specific preferences in Flex Builder:

Resource Displays general information about the project, settings for text encoding, and the operating system line delimiter.

Builders Specifies the build tool to use. A standard builder is included in Flex Builder. You can use Apache Ant (an open-source build tool) to create build scripts or import existing Ant build scripts. (See Customizing builds with Apache Ant.)

Flex Applications Displays the names of the project files that are set as application files, which can be compiled, debugged, and run as separate applications. (See Managing project application files.)

Flex Build Path Specifies the build path, which specifies where external source and library files are located. You can modify the build path and also change the name of the output folder. (See Setting up a project output folder and Building projects manually.)

Flex Compiler Specifies optional compiler preferences, such as generating an accessible SWF file, enabling compiler warnings and type checking, specifying additional compiler arguments, Flex SDK version, and sets HTML wrapper settings. (See Advanced build options.)

Flex Modules Specifies modules to build and optimize for the project. For more information about using modules in Flex Builder, see Creating modules in Flex Builder.

Flex Server Determines the location of the Flex root folder and the Flex server URL (for LiveCycle Data Services projects only), and validates location.

Project References Lists the projects that the current project references.

Run/Debug Settings Manages launch configuration settings.

Importing projects

Flex Builder provides wizards to guide you through steps to import projects. You can work with many projects simultaneously. All projects in the current workspace are displayed in the Flex Navigator view.

You can import existing projects into the workspace or create new projects. Existing projects must be valid Flex Builder projects and reside either in another workspace or, if removed from a workspace, in the file system. You can also work with a project that is not currently in your workspace. The project may be packaged in a single .zip file, or a complete project folder.

Import .zip project (stand-alone configuration)

If the .zip project was created with Export Flex Project Archive:

  1. Select File > Import > Import Flex Project Archive.
  2. In the Import Projects dialog box, select the .zip file you want to import. If the project is compiled on the server (ColdFusion with LiveCycle Data Services or J2EE with/without LiveCycle Data Services), the project location must be the root of LiveCycle Data Services. If a project is not compiled in Flex Builder, you must specify a custom path, ideally under the server's web root. You can import any Flex, AIR, ActionScript, or Library project.
  3. Click Finish.

Import .zip project (plug-in configuration)

If the .zip project was created with Eclipse's Export Archive File:

  1. Select File > Import > General > Existing Projects into Workspace.
  2. In the Import Projects dialog box, enter the root directory or archive file paths as described above.
  3. Click Finish.

Import complete project folder

If you have a project that was downloaded from source control or a different workspace:

  1. Select File > Import > General > Existing Projects Into Workspace and click Next.
  2. In the Import Projects dialog box, select the root directory or archive file option; then enter or browse for the project location.

    You can import the following archive file types: jar, zip, tar, tar.gz, and tgz.

    All valid projects that are available in the specified location are listed in the dialog box.

  3. Select one or more projects, and click Finish.

Note: Importing a project into a workspace creates a link from the workspace to the existing location of the project.

Import folder(s) containing other source files or assets

If you want to import source files or assets not in an actual Flex Builder project, use the New Flex Project wizard:

Create a new project at a specific location and set source and output folder settings to match existing folder structure.

or

Create a new project in a different location and move source files to the new project folder structure.

Exporting projects

Flex Builder provides wizards to guide you through the steps to export a project to an archive file (.zip). You can easily share .zip files with other developers who use Flex Builder by posting the archive file on a web site or attaching it to a Jira bug report.

  1. Select File > Export.
  2. In the Export wizard, select File > Flex > Export Project, then click Next.
  3. In the Export Project dialog box, select a project then enter or browse to enter the location where the .zip file will be exported.
  4. Click Finish to export your project to the designated location.

    For server projects, the paths to the Flex output folder and/or server root are replaced with Eclipse variables. When you export a project, Flex Builder opens readme_flex_export.txt listing which paths were replaced. This readme file is located in the in the .zip archive.

    For more information about Eclipse variables and linked resources, see the Eclipse documentation.

Exporting Adobe AIR application installer

For AIR projects, a production build creates a digitally signed AIR file, which users can install before running the application. This process is similar to creating an installer .exe for a typical native application. Optionally you can create an unsigned intermediate package which you can sign later before release. Before using Export Release Build you should decide how to digitally sign your AIR application:

  • Sign the application using a Verisign or Thwate digital certificate
  • Create and use a self-signed digital certificate
  • Choose to package the application and sign it later

Digital certificates provided by VeriSign and Thwate give users some assurance as to your identity as a publisher and verification that the installation file has not been altered since you signed it. Self-signed digital certificates serve the same purpose but they are not validated by a third party. You can also package your AIR application without a digital signature by creating an intermediate AIR file (.airi). An intermediate AIR file is not valid because it cannot be installed. Instead, developers can use it for testing and then it can be launched using the AIR ADT command line tool. This capability is provided because in some development environments digital signing is handled by a particular developer or team, which ensures an additional level of security.

  1. Select Project > Export Release Build.

    If you have multiple projects and applications open in Flex Builder, select the AIR project you want to package.

  2. Choose the export settings for project and application.
    • If your project does not have a server web root associated with it, all assets are copied to the project_name folder, which is the default location.
    • If your project has server web root associated with it (for example, PHP and J2EE), all assets are copied to the web_root/project_name-debug folder.
    • If you want users to view source code, select Enable View Source.
    • Click Choose Source Files to select files to you want to publish, then click OK.
    • Click Next.
  3. On the Digital Signature page:

    Specify the digital certificate that represents the application publisher's identity. To generate a self-signed certificate, click Create to enter data in required fields.

    If you want to export a file that will be signed later, you can export an intermediate AIRI file.

  4. In the AIR File Contents page, select the output files to include in the AIR or AIRI file.
  5. Click Finish.

For more information about Adobe AIR files, see Developing AIR Applications with Adobe Flex 3.

Moving a project from one workspace to another

You use a combination of deleting and importing operations to move a project from one workspace to another. When you delete a project from a workspace, you can remove it from the workspace but leave it in the file system (see Deleting projects). After you remove a project from one workspace you can import it into another.

Deleting projects

When you delete a project, you remove the project from the current workspace. You can also remove the project from the file system at the same time.

Instead of deleting the project from the workspace, you can close the project. Closing the project lets you keep a reference to it in your workspace and also free some system resources. For more information, see Closing and opening projects.

  1. In the Flex Navigator view, select the project to delete.
  2. Select Edit > Delete from the main menu.
  3. Select an option:

    Also Delete Contents Under Directory Permanently removes the project from the workspace and the file system.

    Do Not Delete Contents Removes the project from the workspace but not from the file system.

Closing and opening projects

To save memory and improve build time without deleting a project, you can close it. When you close a project, you collapse the project and its resources, however, the name remains visible in the Flex Navigator view. A closed project requires less memory than an open project, and is excluded from builds. You can easily reopen the closed project from the Flex Navigator view.

  1. In the Flex Navigator view, select the project to close or reopen.
  2. Right-click (Control-click on Macintosh) to display the context menu and select Close Project or Open Project.

Switching the main application file

When you create a project, the main application file is generated for you. By default, it is named after the project. The main application file is the entry point into your applications and becomes the basis of the application SWF file. However, as you add files to your application, you might want to designate a different file as the main application file.

If you prefer to set multiple files as application files so that each application file is built into a separate SWF file, see Managing project application files.

  1. In the Flex Navigator view, select the MXML application file that you want to make the main application file.
  2. Right-click (Control-click on Macintosh) to display the context menu and select Set as Default Application.

You can manage the application files in your project by selecting Project > Properties > Flex Applications (or ActionScript Applications if you're working with an ActionScript project).

Managing project application files

Usually, a project has a single main application file, which serves as the entry point to your application. The Flex Builder compiler uses this file to generate the application SWF file.

For example, you might have a complex Flex application with many custom MXML components that represent distinct but interrelated application elements. You can create an application file that contains a custom component and then build, run, and test it separately.

By default, whenever you add an MXML application file to your Flex project, you can run the application, and it is added to the list of project application files. All files defined as application files must reside in your project's source folder.

You can manage the list of application files by selecting a project and viewing its properties.

  1. In the Flex Navigator view, select a project.
  2. Select Project > Properties from the main menu or right-click (Control-click on Macintosh) to select Properties from the context menu.
  3. In the Project Properties dialog box, select Flex Applications (or ActionScript Applications if you are working with an ActionScript project).
  4. Add and remove application files as needed. Click OK.

0 comments:

Related Flex Samples

Learn Flex: Flex Samples | Flex Video Tutorials Flex Examples