21 November 2011
The Adobe Flash Platform includes an integrated set of tools that enable you to create Flash projects and edit them using the product of your choice: Flash Builder, Flash Catalyst, and Flash Professional. You can move seamlessly from one product to another as you build and test projects that playback in Flash Player and Adobe AIR.
Each tool has specific advantages that you can use to develop and optimize your projects. For example, even if you use Flash Professional exclusively to create animations and applications, you can leverage the powerful profiling tools in Flash Builder to check for memory usage. After running a Flash application in the profiler, you can analyze the profile data and learn how to optimize its performance.
In this article, you'll explore how to set up Flash projects in Flash Professional so that you can work with them in Flash Builder. This involves using the Project panel in Flash Professional and configuring the FLA file for debugging in Flash Builder. You'll also learn how to open a Flash project in Flash Builder and run a profiling session in the Flash Builder workspace.
Before you begin, download and install the newest version of the Adobe Flash Player Debugger.
You'll begin by creating a new project using Flash Professional and set it up to enable the debugging and performance profiling features in Flash Builder. This is the process you'll follow to create a Flash project so that you can edit it using all of the Adobe Flash Platform products. If you already have a FLA file that you'd like to test, you can use it to create a Flash project. Create a new folder with the same name as the FLA file and copy the FLA file into it. Otherwise, you can create a blank FLA file to learn how to set up future projects.
Creating a new Flash project in Flash Professional
Follow these steps to create a Flash project:
Note: If you selected a root folder in Step 3 that did not contain a FLA file, Flash generates a new FLA file for you, using the default document name: test.fla. If you selected a root folder that already contains a FLA file with a matching name, Flash uses the specified file rather than creating a new one.
During the project creation process, Flash generates the AuthortimeSharedAssets.fla file required to work with Flash Builder projects. By default, all of the project files are placed in the root folder. Keep your Flash project files in a single root directory to ensure that the Flash Platform tools can easily locate the project assets.
Enabling the debugging feature in the Publish settings
Next, you'll update the Publish Settings to work with the debugging features.
This option is not enabled by default. You can't test your Flash project for performance using the profiler in Flash Builder unless you specifically configure the Publishing Settings in the FLA file to allow debugging to occur.
Creating a class file for the Flash project
There's one more thing to set up before you can test the Flash project with the profiler tools. The Flash project must have a class file in the root folder in order to run the application in the profiler, even if your project doesn't require a class file.
Note: While a class file (AS file) with the same name as the project name must exist in the root folder of the Flash project in order to run the profiling session, it is not necessary for you to edit the code. The profiler will run the project even if the class file only contains the default class code; you don't need to add any additional ActionScript.
Adding some basic animation to the Flash project file
If you are working with one of your existing projects, you can choose Control > Test Movie to create the SWF file and skip down to the section titled: Opening the Flash project in Flash Builder. But if you created a brand new Flash file when you created the Flash project, follow the steps below to create a simple tween animation to add some content to the Timeline.
At this point, you've created the Flash project, added some test content, and configured the FLA file to debug it in the Flash Builder profiler.
Next, you'll bring the Flash project you just created into Flash Builder so that you can test the Flash content with the profiler.
Notice that the project files include the SWF and HTML files that you created when you tested the FLA file in the previous section. The bin-debug folder contains the most recent version of the project you last published or tested.
You can double-click the class file (AS file) to open it if you'd like to add or edit the ActionScript code in the Flash Builder workspace. Also notice that you can choose Project > Flash Professional and then select the desired sub menu items to publish, test, or debug your movie right here, just like you can using Flash Professional (see Figure 6).
At this point, the Flash project is open in Flash Builder and you can initiate the profiling session. You'll begin by setting your document class as default application entry point for Flash Builder.
The browser launches and the first frame of your application opens in the browser. The animation is not playing yet because the playback is currently suspended. The Configure Profiler dialog box is displayed on top.
The Flash Profile panel opens. The features you enabled are tracked and the selected data (such as memory usage) is displayed in the chart while the application runs in the browser window. Using the profiler tools, you can determine areas of the application that are taking up too many resources and identify the elements you can optimize to increase performance.
The Flash Builder profiler is a helpful tool for debugging your projects and locating areas of applications that are resource intensive. Even if you primarily use Flash Professional to develop applications, you can create Flash projects and work with the files using any of the tools in the Flash Platform. Take advantage of the profiling tools in Flash Builder to optimize your project files and make them run more efficiently.