Creating Flex projects

When you create a project, the New Flex Project wizard guides you through the steps, prompting you for the type of project to create, the project name, location, and other options.

For information about creating an ActionScript project, see Creating ActionScript projects. For information about creating library projects, see Library projects.

Creating a Flex project with no server

If you do not have a server to configure, this basic configuration lets you specify the output folder for compiled applications. You can optionally set the build paths for your new project.

  1. Select File > New > Flex Project.

  2. Enter a project name.

  3. Select the project location. The default location is the current workspace. To choose a different project location, deselect the Use Default Location option.

  4. Choose the application type (web or desktop).

  5. For application server type, choose None.

  6. Click Finish, or click Next to select more configuration options.

    Additional project configuration options

Creating a Flex project with ASP.NET

With Microsoft Windows and Microsoft Visual Web Developer installed, you can create Flex projects that use ASP.NET for deployment. Also, if you have access to an Internet Information Service (IIS) development server, you can create Flex projects with a Flex output folder under IIS.

  1. Select File > New > Flex Project.

  2. Enter a project name.

  3. Specify the project location. The default location is the current workspace. On Windows platforms, the default workspace is C:\Documents and Settings\Flex Developer\Adobe Flash Builder\. To choose a different project location, deselect the Use Default Location option.

  4. Choose the application type (web or desktop).

  5. For application server type, choose ASP.NET.

  6. Click Next.

  7. Select the ASP.NET server:

    • If you are using an ASP.NET Development Server, there is no need to specify a server location.

    • If you are using IIS, enter the Web Application Root and Web Application URL.

    • Specify the output folder for your Flex application.

  8. Click Finish, or click Next to select more configuration options.

    Additional project configuration options

Creating a Flex project with J2EE

This project configuration lets you create Flex projects that use a J2EE servlet with the remote object access service option. When no option is selected, and Java server is used, an output folder is created under the server root. If you installed the Eclipse Web Tools Project (WTP) plug-in, you can create combined Java and Flex projects with or without remote object access service.

Note: LiveCycle Data Services ES and BlazeDS support specific versions of the Flex SDK. Check the LiveCycle Data Services Compatibility Matrix to see which versions of the Flex SDK your version of LiveCycle DataService ES supports. The compatibility matrix also lists the versions of the Flex SDK that BlazeDS supports.

You have two compile options for creating a Flex project that uses J2EE. The recommended option compiles the application locally, and then saves the files (including the SWF file and HTML wrapper) on the server. The other option compiles the application source file directly on the server.

  1. Select File > New > Flex Project.

  2. Enter a project name.

  3. Specify the project location. The default location is the current workspace. To choose a different project location, deselect the Use Default Location option.

  4. Choose the application type (web or desktop).

  5. For application server type, choose J2EE.

  6. Select the Use Remote Object Access Service option. LiveCycle Data Services ES is automatically selected. You can select BlazeDS. If you installed WTP, you can also choose to create a combined Java and Flex project that uses WTP (the Java source folder is selected for you).

  7. Click Next.

  8. Configure the J2EE server.

    • If you selected the Use Remote Access Service and LiveCycle Data Services or BlazeDS options, specify the root settings:

      Root Folder
      This is the Flex server (web application) that serves your application (for example, C:\fds2\jrun4\servers\default\flex). If you choose not to use the default development server option for Flex, you can specify a new location for the root folder, but it must be a valid folder that is mapped to the specified root URL. If you are using a remote server, specify the location; for example, myServer\MyApplications\jrun4\servers\default\flex.

      Root URL
      This is the valid root URL of the Flex server (web application) that serves your application. For LCDS, the default root URL for local server instances is http://localhost:8400/lcds/. If you use a remote server, the URL might look like this: http://myserver.com:8400/lcds/.

      Context Root
      The context root typically matches the last segment of the root URL path.

    • If you selected the Create Combined Java/Flex Project Using WTP option (with or without LiveCycle Data Services):

      • Specify the names of your Java and Flex source folders and target runtime.

        When you create a Flex project with LiveCycle Data Services ES, Flash Builder either creates a directory with the same name as your project, or uses an existing directory with that name. That directory is a subdirectory of the root folder that you specified for the project.

      • With LiveCycle Data Services ES, specify a flex.war file, which is located in the server installation folder.

    Note: Regardless of which option you choose for a LiveCycle Data Services ES project in Flash Builder, you must specify a valid LiveCycle Data Services ES root folder and root URL. These values map the root of a LiveCycle Data Services ES web application. If you deselect the options, you must enter only your web root and root URL.
  9. Specify the location to compile your project.

    • For applications that compile locally, Flash Builder creates a projectname-debug folder in which the SWF files and HTML wrappers are saved.

    • For applications that compile on the server, the project location must be on the server.

  10. Click Finish, or click Next to select more configuration options.

    Additional project configuration options

Creating a Flex project that accesses ColdFusion services

To access data that uses ColdFusion, you must have either Adobe ColdFusion® 8 or Adobe ColdFusion 9. For more information, see the ColdFusion product page.

  1. Select File > New > Flex Project.

  2. Enter a project name.

  3. Specify the project location.

    Typically you accept the default location, which is the current workspace.

  4. Specify the application type (web or desktop).

  5. For application server type, select ColdFusion, then choose from the following options:

    Use Remote Object Access Service
    If you deselect Use Remote Object Access Service, specify your Web Root and Web Root URL in the next step.

    If you select Use Remote Object Access Service, you have the following choices:

  6. Click Next. Specify a server location, Web Root, Web Root URL, and Context Root:

    If accessing a remote object service, you can configure a standalone ColdFusion configuration or a ColdFusion configuration deployed to a J2EE server:

    • Standalone

      Use the Standalone option if your ColdFusion installation uses the server configuration.

      Specify the location of the ColdFusion server, location of the Web Root, and Web Root URL.

    • Deployed to J2EE Server

      Use the Deployed to J2EE option if your ColdFusion installation uses either the multiserver or J2EE configurations.

      Specify a Web Root, Root URL, and Context Root. If you are using the ColdFusion multiserver configuration, you typically do not have to specify the Context Root.

      The context root typically matches the last segment of the root URL path when you deploy ColdFusion as a web application in the ColdFusion J2EE configuration.

    When specifying the location of the server and web root, navigate to a local directory or specify a path to a directory on a network server. Make sure the directory is a shared directory and the account under which Flash Builder is running has write access.

    Make sure you have mapped or mounted a network drive for the network server. The path to a network server is platform-specific. For example:

    (Windows) \\10.192.18.12\server\webroot

    (Windows) Z:\webroot

    (Mac) /Volumes/webroot

  7. Click Validate Configuration to ensure the setup is correct.

    If the web root directory is not writable, then Flash Builder displays a warning.

  8. Choose an output folder for the compiled application.

  9. Click Finish, or click Next to select more configuration options.

    Additional project configuration options

Creating a Flex project that accesses PHP services

To access data from PHP services, a server hosting the services must be available. The server can be either a local server or a server available from a local network.

  1. Select File > New > Flex Project.

  2. Enter a project name.

  3. Select the project location. The default location is the current workspace. To choose a different project location, deselect the Use Default Location option.

  4. Choose the application type (web or desktop).

  5. For application server type, choose PHP. Click Next.

  6. Specify the Web Root and Root URL for the service. Click Validate Configuration.

    Typically, you specify a Web root and root URL that is local to your environment. However, you can also access network servers. Make sure the directory is a shared directory and the account under which Flash Builder is running has write access.

    Make sure you have mapped or mounted a drive for the network server. Then specify a path to the server. The path is platform specific. For example:

    (Windows) \\10.192.18.12\server\webroot

    (Windows) Z:\webroot

    (Mac) /Volumes/webroot

  7. (Optional) Specify the output folder for your application.

  8. Click Finish, or click Next to select more configuration options.

    Additional project configuration options

Additional project configuration options

When creating a Flex project, you can customize its configuration. All additional configuration steps are optional.

Note: You can also change a project’s configuration after the project has been created. When the Flash Builder editor is in Source mode, go to Project > Properties.
  • Main source folder, main application file, and output folder URL.

    By default, Flash Builder places source files in a projects src folder. The default name of the main MXML application file is the name of the project. You can change these defaults when creating the project.

    When you create a project, Flash Builder runs application files from a default URL based on your project settings. Specify an output folder URL to override the default settings.

    See Setting up a project output folder and Running applications.

  • Component Set

    Typically, you make all components available. In some cases, you specify MX components only. See Component Set (MX + Spark or MX Only).

  • Framework Linkage

    By default, application classes for the Flex 4 framework use dynamic linking. The following options are also enabled by default:

    • Verify RSL Digests

    • Use Local Debug SWF RSL When Debugging

    • Automatically Determine Library Order Based on Dependencies

    See Application Framework Linkage.

  • Build Path Libraries

    You can add or remove project libraries, SWC library folders, or SWC files to the build path. You can also change the build path order.

    Use the Edit button to change the location of added libraries or folders.

    Use the Add Flex SDK button to restore the default SDK for a project if you removed the Flex SDK from the build path.

  • Additional source folders

    Use the Source tab to add additional source folders to a project. You can reorder the source folders, edit the location of folders, and remove folders from the source path.

Changing server options of existing projects

At times you may find that the original server configuration for a project does not meet your current needs. You can reconfigure the server configuration for a web application or desktop application from the Project Properties window.

In the Project Properties window select the Flex Server option to add or change the server options for the project:

  • Select None to remove the server configuration from a project.

    Removing the server configuration from a project removes any added SWCs on the library path for that server type.

  • Select a server type to change or add the server configuration of a project

    All the server options for the selected server configuration are available. See Creating Flex projects for details on server configuration settings.

    Changing the server type of a project can result in errors in existing code that relies on the original server type. You will need to investigate and correct any resulting errors in your code.

Creating a Flex 4 project that uses only MX components

You can create a Flex project that is compatible with MX components that were available with Flex 3. This MX Only option is useful for creating applications that are similar in design to applications created with the previous release of Flex, but still have access to Flex 4 and Flash Builder 4 features (such as the new states syntax, advanced CSS, compiler improvements, and other language features).

If you specify MX Only for a project, then Spark components available with Flex 4 are not available to applications in the project.

You can convert a Flex 4 project to be an MX Only project. However, Flash Builder does not rewrite any code in the project. You must manually update your code to remove any reference to Spark components.

Creating an MX Only Flex project

  1. Select File > New > Flex Project.

  2. Enter a project name.

  3. Select the project location. The default location is the current workspace. To choose a different project location, deselect the Use Default Location option.

  4. Choose the application type (web or desktop).

  5. Specify an application server type (or specify none if an application server type is not required). Click Next.

  6. (Optional) Specify the output folder for your application.

  7. Click Finish, or click Next to select more configuration options.

    Additional project configuration options

Converting a Flex project to an MX Only Flex project

  1. Make the project you want to convert the active project in Flash Builder:

    Typically, you open a source file in the project to make the project active.

  2. Select Project > Properties > Flex Build Path.

  3. For Component Set, select MX Only. Click OK.

  4. Modify any application code in the project that accesses Spark components.

    You cannot reference Spark components in an MX Only project.

Creating Flash Professional projects

Use Flash Professional projects to access Flash FLA or XFL files created with Flash Professional CS5. This feature allows Flash Professional developers to take advantage of the editing and debugging environment available with Flash Builder. The features of Flash Professional projects are only available in Flash Builder if you have installed Flash Professional CS5.

Typically, you create a project and files in Flash Professional. Then you create a corresponding project in Flash Builder to edit and debug the files. When editing the files in Flash Builder, you can set breakpoints in the project’s ActionScript files. Breakpoints set in files that are in the Flash Professional project are recognized by the Flash Professional debugger when you call Debug Movie.

You can launch Flash Professional from Flash Builder to publish and run the files. You can also launch the Flash Professional debugger from Flash Builder.

Creating a Flash Professional project

  1. Select File > New Flash Professional Project.

  2. Navigate to the target FLA or XFL file for the project.

    The name of the file becomes the name of the project.

  3. Specify a project location:

    You can use either the default project location in the workspace or navigate to a new project location.

  4. Click Finish.

    Flash Builder opens the new project in the Package Explorer. The folder containing the target FLA file is accessible. The selected FLA file becomes the target file in the project. ActionScript files that are dependent to the target files are available for editing.

    If Flash Professional is not running, Flash Professional starts.

Working with Flash Professional projects in Flash Builder

You can do the following with source files in a Flash Professional project:

  • Edit the ActionScript files that are dependent to the target FLA file.

  • Debug the file in the Flash Builder debugger or Flash Professional Debugger:

    To debug in Flash Builder, select Run > Debug file or click the Debug button from the toolbar.

    To debug the file in Flash Professional, select Run > Debug Movie or click the Debug Movie button in Flash Builder. Breakpoints set in Flash Builder are recognized in the Flash Professional debugger.

  • Publish the file in Flash Professional CS5:

    Select Project > Publish Movie or click the Publish in Flash Professional button from the toolbar.

  • Run the file in either Flash Builder or Flash Professional:

    To run the file in Flash Builder, select Run > Run file or click the Run button from the toolbar.

    To run the file in Flash Professional, select Run > Test Movie or click the Test Movie button from the toolbar.

Setting project properties for Flash Professional projects

  1. Select Project > Project Properties > Flash Professional.

  2. Select Add to add additional files to the project.

    A project can have only one target FLA or XFL file as the default target file. Use the Set as Default button to specify the default target file for the project.

  3. Click OK.