Creating Components > Defining the component parameters

 

Defining the component parameters

Component parameters are pieces of data that are passed to a component when it loads in a movie. You use these parameters to change the appearance and behavior of the component while the movie is playing. Defining these parameters is a required part of the component creation process.

To add parameters to the component, you use the Component Definition dialog box. When you create a parameter, you give it a name, indicate the variable it is associated with, assign it a value, and specify a type.

 
To define component parameters:

1

Select the component movie clip in the movie's Library panel (Window > Library).

2

Do one of the following to display the Component Definition dialog box:

Right-click (Windows) or Control-click (Macintosh), and choose Component Definition from the context menu.

Click the options menu control in the upper right of the Library panel and choose Component Definition.

3

Use the controls in the Component Definition dialog box as follows:

Click the Add Parameter (+) button to add a new set of parameters.

Click the Delete Parameter (-) button to delete a set of parameters.

Use the arrow keys at the upper right to change the order of parameters in the list.

Select a field by double-clicking on it, and then enter a value.

4

Enter the parameter name in the Name field.

The parameter name helps users understand the purpose of the parameter. The name does not need to conform to variable naming conventions.

5

Enter the parameter variable in the Variable field.

The parameter variable is the variable name used in executing ActionScript commands attached to the component movie clip. The variable name must be a valid ActionScript variable name. The entry in the Variable field must conform to identifier naming conventions. The first character must be a letter, underscore (_), or dollar sign ($). Each subsequent character must be a letter, number, underscore, or dollar sign.

Note: You can enter the parameter variable name in the Name field, and leave the Variable field blank. Flash then uses the entry in the Name field to execute ActionScript commands.

6

Select the parameter type from the Type pop-up menu.

The parameter type identifies the data type, or the kind of information, that the parameter variable can hold. Parameters can be of type Array, Object, List, String, Number, Boolean, Font Name, Color, or Default. For Default type, Flash interprets the type based on the value entered. True and false values are interpreted as Boolean type. Numeric values are interpreted as type Number. All other values are interpreted as type String. For more information on data types, see Flash Help (Help > Using Flash > Understanding the ActionScript Language > About data types).

Note: Select the type before you enter the value. If you select the type after entering the value, the value is set to the default.

7

Enter the default parameter value in the Value field.

The parameter value is the default value assigned to the parameter variable when the variable is called in ActionScript commands. The value you enter in the Component Definition dialog box is the default value for the parameter. The component uses this value until a user enters a new value for the parameter.

8

Under Options, select or deselect the following options:

Select Parameters Are Locked in Instances to prevent users from adding or deleting parameters in instances of the component. Deselecting this option enables users to add or delete parameters in instances of the component. Deselecting this option is not recommended.

Select Display in the Components Panel to include the component in the Components panel. Next, enter the text you want to display in the Components panel in the Tool Tip Text text box. The tooltip text is displayed when you roll over the component name in the Components panel.

9

If you want to set up a custom interface for the component, see Creating a custom interface for a component.

10

If you want to set up a Live Preview for the component, see Creating a Live Preview movie.

11

If you want to create a description for the component, see Adding a description to the component.

12

Select an icon for the component. If you want to display a standard icon for the component, click the Component Icon button and select an icon. If you want to create a custom icon, see Creating a custom icon.

13

Click OK to close the Component Definition dialog box.