Chapter 25. Importing Your Project into Flash Builder

IN THIS CHAPTER

  • Importing Catalyst projects into Flash Builder

  • Running a project from Flash Builder

  • Merging changes from Catalyst into an existing Flash Builder project

In order to finish the Magazines Direct project, you will need to import it into Flash Builder, where either you or a Flex developer will add any additional functionality that cannot be handled by Catalyst. You can also run the project from Flash Builder to preview it.

Once the project has been opened and edited in Flash Builder, you will no longer be able to open it in Catalyst. However, if you keep a backup copy of the original project, you can open that in Catalyst, make needed changes, and then merge those changes back into the Flash Builder project.

Beginning the Import Process

Catalyst creates FXP files. An FXP file is actually nothing more than a zipped Flex project, which can be opened directly in Flash Builder. Therefore, there is nothing special you actually need to do in order to export your file to Flash Builder; it will automatically be in a file format supported by Flash Builder.

However, it is a good idea to make a back-up copy of the project so that it can be opened later by Catalyst if changes need to be made.

Note

The exercises in this chapter assume that you have completed the exercises in Chapter 24. If you have not, you can download a version of the project as of the start of this chapter from the book's Web site (www.wiley.com/go/flashcatalystbible).

  1. In Catalyst, choose File

    Beginning the Import Process
  2. Navigate to the folder into which you wish to save the back-up copy of the project.

  3. If necessary, rename the project.

  4. Click Save (see Figure 25.1).

    Saving a back-up copy of the project

    Figure 25.1. Saving a back-up copy of the project

    Note

    If you'd prefer, you can also create a backup copy of the project using Windows Explorer or Finder on the Mac.

  5. Open Flash Builder. On Windows, choose Start

    Saving a back-up copy of the project
    Flash Builder immediately after launch

    Figure 25.2. Flash Builder immediately after launch

    Note

    If you do not have a copy of Flash Builder, you can download a free trial version from www.adobe.com/products/flex. The trial is fully-functional, but will eventually time-out and stop working.

  6. In Flash Builder, choose File

    Flash Builder immediately after launch
  7. Click the Browse button to browser for a file to import.

  8. Navigate to the directory that contains the original FXP project from Catalyst.

  9. Click Import.

  10. On the Import Flex Project dialog box, click Finish (see Figure 25.4). The project will be imported into Flash Builder.

    Selecting the Import Flex Project menu command

    Figure 25.3. Selecting the Import Flex Project menu command

    The Import Flex Project dialog box in Flash Builder

    Figure 25.4. The Import Flex Project dialog box in Flash Builder

  11. Expand the package in the Package Explorer in Flash Builder to examine the project's files (see Figure 25.5).

    Examining the project's files in the Package Explorer in Flash Builder

    Figure 25.5. Examining the project's files in the Package Explorer in Flash Builder

  12. Open Main.mxml from the Package Explorer. This is the primary file created by Catalyst, and represents the starting file for the project.

  13. If necessary, click Design to view the project in Design mode. The view of the project in Design mode should closely resemble Catalyst's view (see Figure 25.6).

  14. Click Source. This switches to Flash Builder's code view, where you can edit the code for the project.

  15. Examine the code that was created by Catalyst (see Figure 25.7).

    The project in Flash Builder's design mode

    Figure 25.6. The project in Flash Builder's design mode

    The project's main file in source view

    Figure 25.7. The project's main file in source view

    There will likely be less code in this file than you may have anticipated, as it does not contain all of the code for the project. Every component is contained within its own, independent MXML file.

  16. In the Package Explorer, click the arrow to open the CustomComponents folder.

  17. Double-click one of the custom components to open it. In this example, the SubscriptionAssets component has been opened.

  18. Examine the source code of the component (see Figure 25.8).

    The component's source code

    Figure 25.8. The component's source code

  19. Click Design to switch back to Design mode. Again, the component appears in Flash Builder in a manner very similar to what you saw in Catalyst (see Figure 25.9).

You have now imported your Catalyst project into Flash Builder and examined some of the elements of the project.

The component in Design mode

Figure 25.9. The component in Design mode

Running a Project in Flash Builder

Just as you can run a project in Catalyst to view how it will appear to your user, you can do the same in Flash Builder. The key difference is that, by default, Catalyst opens the project in a stand-alone version of Flash Player, while Flash Builder defaults to opening the project in a Web browser.

  1. In Flash Builder, ensure that you are viewing the project's main file. When you have multiple files open in Flash Builder, you can switch between them by clicking the tabs in the top-left corner of the editing window (see Figure 25.10).

  2. From the Flash Builder toolbar, click the Run button (see Figure 25.11). Its icon is a green circle with a white arrow. You can also choose Project

    Running a Project in Flash Builder

    Depending on the size and complexity of the project and your computer's resources, this process may take some time. A Build dialog box will display the progress while the project is built, or compiled (see Figure 25.12).

Returning to the main application file

Figure 25.10. Returning to the main application file

The Run button in Flash Builder

Figure 25.11. The Run button in Flash Builder

Once the build is complete, the project will open in your computer's default Web browser. It should be fully functional, so you can click buttons, change states, fill out forms, and otherwise use the project. When you finish testing the application, you can return to Flash Builder to continue working on it.

The project running in the browser

Figure 25.12. The project running in the browser

Merging Changes from Catalyst into Flash Builder

Once a project has been opened and edited in Flash Builder, you will no longer be able to open it in Catalyst. In an ideal workflow, this would not be necessary; the design phase of the project will have been completed in Catalyst, and all that will remain will be editing it in Flash Builder.

However, ideal workflows rarely, if ever, apply in the real world. The unfortunate fact is that there will be times when edits need to be made to the visual interface of the project, and it may be easier to complete those edits in Catalyst rather than in Flash Builder. Therefore, you can open a back-up copy of the project in Catalyst, edit it, and then merge those changes into Flash Builder. Follow these steps:

  1. In Catalyst, choose File

    Merging Changes from Catalyst into Flash Builder
  2. Select the back-up copy of the project.

  3. Click Open (see Figure 25.13).

    Selecting the back-up copy of the project to be opened in Catalyst

    Figure 25.13. Selecting the back-up copy of the project to be opened in Catalyst

  4. Make any needed changes to the project. In this example, the heading text in the HomeState component is being changed (see Figure 25.14).

    Editing the project in Catalyst

    Figure 25.14. Editing the project in Catalyst

  5. Choose File

    Editing the project in Catalyst
  6. Choose File

    Editing the project in Catalyst
  7. Type a new name or navigate to a new location to save the back-up (see Figure 25.16).

    Saving the project

    Figure 25.15. Saving the project

    Saving a new back-up of the project

    Figure 25.16. Saving a new back-up of the project

  8. Switch to Flash Builder.

  9. Choose File

    Saving a new back-up of the project
  10. Click Import new copy of project (see Figure 25.17).

  11. Navigate to the location of the new file from Catalyst. The changes will be opened in Flash Builder as a new project.

    Importing a new copy of the project

    Figure 25.17. Importing a new copy of the project

  12. To merge those changes into the existing project, right-click (

    Importing a new copy of the project
  13. Select Compare With (see Figure 25.18), than select the original project. If it is the only other project currently open in Flash Builder, it will be the only item on the list.

    Flash Builder examines the code in both projects and display a dialog box detailing the differences it discovers between the two. Depending on the size and complexity of the files and your computer's resources, this process might take some time to complete.

    Selecting the Compare with command

    Figure 25.18. Selecting the Compare with command

  14. Expand the src folder, then the components folder, and then double-click HomeState.mxml. The component opens and the first difference between the files is highlighted.

  15. Click Next Difference to move to the next change. If necessary, scroll to the right to see the highlighted differences (see Figure 25.19).

  16. Click Copy All from Left to Right (see Figure 25.20).

    Changes highlighted in the code

    Figure 25.19. Changes highlighted in the code

    Accepting the changed code

    Figure 25.20. Accepting the changed code

  17. Click Close on the Compare window's tab (see Figure 25.21).

    Closing the Compare window

    Figure 25.21. Closing the Compare window

  18. Click Yes to save the comparison (see Figure 25.22).

  19. Right-click (

    Closing the Compare window
Saving the file comparison

Figure 25.22. Saving the file comparison

Closing the project ensures that you will not accidentally begin editing it, instead of the other version of the project. You may want to actually delete the project from Flash Builder by right-clicking (

Saving the file comparison

Should you find yourself making multiple edits in Catalyst that need to be merged with Flash Builder, you will need to develop a clean naming convention for the new projects to avoid confusion. You may also want to treat the files to be merged as temporary files, deleting them immediately after merging into Flash Builder, so that you only keep two copies of the project:

  • The copy being edited in Flash Builder

  • The back-up for editing in Catalyst

You should also work with your Flex developer to attempt to limit the number of times changes need to be merged; for example, you may not want to send the developer a new copy of the project for every change, but instead wait to try to combine several changes together.

Closing the new project in Flash Builder

Figure 25.23. Closing the new project in Flash Builder

Summary

This chapter showed the workflow between Catalyst and Flash Builder. You learned:

  • How to import a Catalyst project for editing in Flash Builder

  • Run the project in a Web browser

  • Make changes in Catalyst and merge them back into the Flash Builder project

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.59.219