Accessibility
Flash logo

Adobe

 

Created:
27 July 2009
User Level:
Intermediate
Products:
Flash

Components Learning Guide for Flash: Creating custom components

Components are prebuilt pieces of content (movie clips) that you can reuse within your Flash projects. The components that ship with Flash CS4 Professional are designed to speed your development process, but you can also build your own. Custom components can be saved or installed into the Components panel and can appear in their own category.

To create a custom component in Flash CS4, simply right-click a movie clip symbol in the Library and choose the Component Definition option. The Component Definition dialog box (see Figure 1) allows you to add parameters and component features to a symbol. Doing so transforms the movie clip into a component with properties that can be configured in the Component Inspector panel.

Component Definition dialog

Figure 1. Component Definition dialog box showing the alpha property being exposed as a component parameter

To create a live preview and publish the custom component, right-click the component movie clip symbol and choose the Export SWC File option. Exporting the SWC saves a compiled version of the component and automatically generates a live preview. By default, Flash saves the SWC in the user Configuration folder which, in turn, makes the component appear as a reusable object in the Components panel. For more information on component architecture and SWC files, please see the Component architecture section of the Using ActionScript 3 Components online documentation.

Custom components can be simple or complex. Creating advanced component features requires ActionScript classes to generate component functionality and component metadata to generate parameters. The process for creating components using ActionScript 2 and ActionScript 3 is relatively similar; however, ActionScript 3 should be used whenever possible as a best practice.

For more information on building advanced component architectures, see Jeff Kamerer's series on creating ActionScript 3 components in Flash:

You can also create custom components for use in the Adobe Flex framework while developing in Flash CS4. For more information, please see the Working with Flash and Flex section of the Using Flash CS4 Professional online documentation.

You can package components saved as SWC files using the Adobe Extension Manager. The Extension Manager enables you to create and install MXP files as an easy way to distribute extensions for Flash CS4 as well as other products in Adobe Create Suite 4. For more information, please see the Using Adobe Extension Manager CS4 online documentation.

About the author

This content was authored by Adobe Systems, Inc.