Building a basic application

When you create an application in Flash Builder, you first create a project file. The project file contains a default MXML application which you can edit in either Design View or Source View of the Flash Builder source editor.

If there are errors in your code, Flash Builder flags them for easy access to the offending code.

After creating the application, export a release version of the application.

Create and run an application

The application you create contains a Label component that displays styled text.

  1. In Flash Builder, select File > New > Flex Project.

  2. Specify Hello for the project name.

  3. Make sure that the following default settings are correctly specified:

    Application Type

    Web

    Flex SDK Version

    Use Default SDK

    Application Server Type

    None/Other

  4. Click Finish.

    Flash Builder creates the project and opens an empty MXML application source file in Source View.

    Flex projects always contain application source files. An MXML file is a source file providing an interface to an application. The Flex project also contains compiled versions of the application, libraries, and other assets used by the application.

  5. Select Design.

    Flash Builder switches to Design View.

  6. In the Components View, make sure that the Controls folder is open. Scroll the controls to find the Label control.

  7. Drag a Label component from the Components View to the editing area of Design View.

  8. Make sure the Label component is still selected. In the Properties view, select the Text field and replace the default text with Hello.

  9. In the Properties view, modify the appearance of the text by specifying the following:

    Font Size

    24

    Font Attribute

    Bold

    Font Attribute

    Italic

  10. Select Source to switch to Source View.

    A Label tag has been inserted into the MXML file. The Label tag contains attributes for the values you specified in Design View.

  11. Place the cursor after the last attribute in the Label tag. Type a space. Then begin typing col to add the color attribute.

    A list of available attributes updates as you type. If you click an attribute in the list, documentation for the attribute appears.

    Double-click the color attribute and specify red.

  12. Save the file, and then click the Run button to run the application.

    The application runs in a web browser.

Correct coding errors and export the application

Introduce an error in an application. Then find and fix the error. Finally, export a release version of the application.

  1. In the Hello.mxml file created in the previous procedure, delete the closing angle bracket in the Label tag.

    Change /> to /.

  2. Save the file.

    When you save a file, Flash Builder automatically compiles the application. Flash Builder flags errors in the Package Explorer and source code. Flash Builder lists errors in the Problems View.

    The Problems View is now visible. Expand the Errors list to view the error. Double-click the error to go directly to the source code.

  3. Fix the error and click Save.

    There are no errors listed in Problems View.

  4. Select the Export Release Build button to create a release version of the application.

  5. In the Export Release Build dialog box, select the Enable View Source check box. Accept the default settings. Click Finish.

    Flash Builder creates a bin-release folder and places the application and its assets in this folder. The application is ready to be deployed.

    During application development, Flash Builder compiles the application into a SWF file that contains debug information. The default location for the SWF file is the bin-debug folder in your Flex project. You can export a release version of the application, which does not contain the debug information. The default location for a release version is the bin-release folder in your Flex project.