15 February 2009
This article assumes that you have a basic understanding of Flex and some prior experience working with Flash.
Intermediate
Over the past year, Adobe received feedback from designers and developers requesting updated workflow integration between Adobe Flex 3 and Adobe Flash CS4 Professional. Users of previous versions of Flex and Flash indicated that they enjoy building projects with both programs, and would appreciate a more seamless experience when using these two powerful tools together. We listened to these requests and have responded by improving the workflow features in the release of Adobe Creative Suite 4.
The Flash and Flex teams have made many changes in the CS4 release to ensure a smooth workflow to facilitate application design and development. This article highlights one of the major advantages: the ability to develop your code in Flex and then test the project using Flash. I also describe some of the new enhancements designed to make the process of moving between Flex and Flash more intuitive than ever before.
This section highlights some of the new workflow integration features available in Creative Suite 4. I'll begin by describing some of the new settings available in Flash CS4 Professional that make the Flash authoring environment more consistent when developing code in Flex.
Follow the steps below to review the new class path interface:
The Advanced ActionScript 3.0 Settings dialog box appears (see Figure 2).
The interface has been revised in Flash CS4 to offer a consistent workflow for Flex developers. There are now three tabs for setting the class path, and the tab sections are organized by Source path, Library path, and External library path to mirror the setup in Flex and Flex Builder (see Figure 3).
Here's a description of the information to add in each of the three new path sections available in Flash CS4 Professional:
Note: If you wish to remove a path to a folder or a specific SWC file, click the minus (–) icon while the path is selected.
You can access all three of these sections by clicking the corresponding tabs in the Advanced ActionScript 3.0 Settings dialog box (see Figure 6).
Note: The fourth tab on the right accesses the section to set Config constants. An overview of this section is outside the scope of this article, although I plan on discussing this in an upcoming article that focuses on working with these settings and conditional compilations.
In previous versions of Flash, the Source path was displayed as part of the global class path. In Flash CS4, the Source path is organized and displayed in its own section.
The Source path contains "." by default. By default, the Library path automatically contains:
$(AppConfig)/ActionScript 3.0/libs
The External library path contains "." as well.
These changes have been made to make Flash CS4 behave more like Flex, which does not use a global class path at all. However, the global class path in Flash CS4 is still available for use by Flash developers who have become familiar with setting the global class path and want to continue using it (see Figure 7).
In the previous section I reviewed the changes to the Advanced ActionScript 3.0 Settings dialog box and compared the new sections for setting the Source path, Library path, and External library path in Flash CS4. This is just one of the many improvements to make Flash CS4 more consistent with the workflow used in Flex.
This section covers the step-by-step instructions for testing your code created in Flex within the Flash CS4 Professional authoring environment. This is an exciting new way to build projects because you can code in Flex and then take advantage of Flash to review and test the project. If you wish to follow along, download and uncompress the sample files folder:
Follow these steps to see how you can build a project in Flex:
var child:Shape = new Shape();
child.graphics.beginFill(0×003355);
child.graphics.drawRect(50,100,200,100);
child.graphics.endFill();
addChild(child);
Now that you've created a small Flex project, let's see how to test that code in Flash:
var flexObj:FlashClass = new FlashClass();
addChild(flexObj);
Now let's try the entire workflow to see how Flex works with Flash. You'll update the Flex code to see how the changes made to the project are automatically reflected in the Flash SWF file:
child.graphics.beginFill(0×222222);
child.graphics.drawRect(50,100,400,100);
Note: The approach described above does not work when applied to the Doc class or to symbols inside the Library.
To learn more about working with Flex and Flash together, read R Blank's article, Exploring a unified component workflow between Flex and Flash. Also watch the online video tutorials on the Flash channel and Flex channel on Adobe TV.
Also be sure to visit the Flash Developer Center and Flex Developer Center, where you'll find more articles, tutorials, and sample projects to get you up to speed quickly.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
Flash User Forum |
More |
| 04/23/2012 | Auto-Save and Auto-Recovery |
|---|---|
| 04/23/2012 | Open hyperlinks in new window/tab/pop-up ? |
| 04/21/2012 | PNG transparencies glitched |
| 04/01/2010 | Workaround for JSFL shape selection bug? |
Flash Cookbooks |
More |
| 02/13/2012 | Randomize an array |
|---|---|
| 02/11/2012 | How to create a Facebook fan page with Flash |
| 02/08/2012 | Digital Clock |
| 01/18/2012 | Recording webcam video & audio in a flv file on local drive |