The Project panel contains a handful of subtle, yet powerful features to help you combine assets for your project. This section describes a few of the ways you can use the Project panel to build upon the concepts covered earlier in the article.
If you have previously used the Flash CS3 Project panel, you can still load your project in the Flash CS4 format.
To update a Flash CS3 project to Flash CS4 format:
Note: An alternate approach involves opening the primary FLA file in the Flash CS3 project folder and then selecting the Quick Project option in the Project panel's Project Menu options.
The Project panel allows you to assign a custom class template to a standard class and a class bound to a symbol in the Library. Realistically, this feature is intended for general class templates that can be applied to a number of uses. However, you can also use this feature to swap templates easily and apply different predefined functionalities to different symbols.
To create and apply a template containing drag-and-drop functionality to a symbol:
Update the template code to match the following code shown below:
package %PACKAGE_NAME%
{
import flash.events.MouseEvent;
import src.core.Component;
/**
* Class creates a component.
*
* @langversion ActionScript 3.0
* @playerversion Flash 9.0
* @tiptext
*/
public class %CLASS_NAME% extends Component
{
//*********************************
// Properties:
public var isDragging:Boolean = false;
//*********************************
// Initialization:
public function %CLASS_NAME%():void
{
// Initialize...
addEventListener(MouseEvent.MOUSE_DOWN,dragPressHandler);
addEventListener(MouseEvent.MOUSE_UP,dragReleaseHandler);
}
//*********************************
// Properties:
private function dragPressHandler(event:MouseEvent):void
{
// Constrain drag to Stage area
var rx:Number = 0;
var ry:Number = 0;
var rw:Number = stage.stageWidth - width;
var rh:Number = stage.stageHeight - height;
var rb:Rectangle = new Rectangle(rx, ry, rw, rh);
// Start dragging...
isDragging = true;
startDrag(false, rb);
}
private function dragReleaseHandler(event:MouseEvent):void
{
if( isDragging ){
isDragging = false;
// Stop drag
stopDrag();
}
}
}
}
Note that this approach works well if you're planning on creating new classes for every symbol you assign the class to. If you want to assign a class to more than one symbol, then you'll have to manually assign the class to the Base class field in the symbol's properties.
Flash JavaScript (JSFL) is an extensibility layer built into Flash CS4 that allows you to control the author-time environment using JavaScript. You can create JSFL commands as options in the Commands menu, as commands triggered by ActionScript in custom Window SWF panels, or as stand-alone scripts that cause the Flash IDE to respond when activated.
The Project panel is a Window SWF containing a JSFL API that you can use to extend the panels utility in the Flash workspace. You may find this feature useful if you want to create Commands related to the Project panel.
To create a JSFL file, follow these steps:
Note: You'll need to download and install the latest update to the Flash CS4 Project panel to see the JSFL commands work. Assuming that you're using the latest files, you can use the following JSFL commands related to the Project panel:
createProject(uri:String, name:String, asVersion:Number) // Point to an FLA or a directory createQuickProject() openProject(uri:String) // Recent project list: getRecentProjectList():Array // Project settings (affect current project): getName():String setName(value:String) getURI():String setURI(value:String) getASVersion():Number setASVersion(value:Number) // value can be 2 or 3 getClassTemplate():String setClassTemplate(uri:String) getSymbolClassTemplate():String setSymbolClassTemplate(uri:String) runCompileList():Boolean getCompileList():Array addToCompileList(uri:String):Boolean removeFromCompileList(uri:String):Boolean getLocationNames():Array getLocationURIs():Array addLocation(uri:String, name:String) removeLocation(uri:String):Boolean getFlexSDKPath():String setFlexSDKPath(value:String) // for source, library, and external lib: getLibraryPaths():Array addLibraryPath(uir:String) removeLibraryPath(uri:String); getSourcePaths():Array addSourcePath(uri:String) removeSourcePath(uri:String) getExternalLibraryPaths():Array addExternalLibraryPath(uri:String) removeExternalLibraryPath(uri:String)
Please see the Extending Adobe Flash CS4 Professional documentation for more information on using JSFL.
The Project panel allows you to compile the Flex SDK and other external ActionScript libraries along with your Flash CS4 project. This opens up possibilities for manipulating Flex project files inside your Flash CS4 project. You can also use this feature to aggregate public ActionScript libraries that you obtain from Google, Yahoo!, and elsewhere.
To include the Flex SDK in your project, follow these steps:
Click the Paths tab and then click on the folder icon next to the Flex SDK field to browse for the location of the Flex SDK on your computer (see Figure 11).

Figure 11. Project properties settings pointing to a Flex project
Note: You need to publish the project files using the Project panel in order to see the external code libraries compiled with the project.
After following along with the steps outlined in this tutorial, you have the skills to create and manage projects and assets in Flash CS4. Even more exciting, you can now aggregate everything you need to develop organized projects quickly that include assets from multiple resources.
The next step in project planning is to define a directory structure and a systematic approach for organization that works best for you. Think about your long-term goals and develop a structure that facilitates your workflow to create future projects:
Spend some time thinking about it; it's usually worth the effort.
If you'd like to research further and extend the template, experiment with customizing the Photo Gallery to make it unique. Update it to suit your needs. Check out some of the ActionScript 3 tutorials available on the ActionScript Technology Center and try adding some new features of your own.