19 January 2011

Components are prebuilt controls (movie clips) that you can reuse within your Adobe Flash Professional projects. The components that ship with Flash Professional CS5 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 Professional, 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 Properties panel.

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 Professional. For more information, please see the Working with Flash Pro and Flash Builder section of the Using Flash 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 or ZXP files as an easy way to distribute extensions for Flash Professional as well as other products in the Adobe Create Suite. For more information, please see the Using Adobe Extension Manager CS5 online documentation.