User Guide

956 Chapter 7: Creating Components
Adding an icon
You can add an icon that represents your component in the Components panel of the Flash
authoring environment.
To add an icon for your component:
1.
Create a new image.
The image must measure 18 pixels square, and you must save it in PNG format. It must be 8-
bit with alpha transparency, and the upper left pixel must be transparent to support masking.
2.
Add the following definition to your component’s ActionScript class file before the
class definition:
[IconFile("component_name.png")]
3.
Add the image to the same directory as the FLA file. When you export the SWC file, Flash
includes the image at the root level of the archive.
Adding a tooltip
Tooltips appear when a user rolls the mouse over your component name or icon in the
Components panel of the Flash authoring environment.
You can define a tooltip in the Component Definition dialog box. You can access this dialog box
from the Library options menu of the component’s FLA file.
To add a tooltip in the Component Definition dialog box:
1.
Open the Component Definition dialog box.
2.
Select the Display in Components Panel option.
3.
Enter the text of your tooltip in the Tool Tip Text text box.
Component development checklist
When you design a component, use the following practices:
Keep the file size as small as possible.
Make your component as reusable as possible by generalizing functionality.
Use the RectBorder class (mx.skins.halo.RectBorder) rather than graphical elements to draw
borders around objects. (See “RectBorder class” on page 647.)
Use tag-based skinning.
Define the symbolName, symbolOwner, and className variables.
Assume an initial state. Because style properties are now on the object, you can set initial
settings for styles and properties so your initialization code does not have to set them when the
object is constructed, unless the user overrides the default state.