• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Lesson 8. Using Components > Using the CheckBox Component

Using the CheckBox Component

The CheckBox component lets you add check boxes to your Flash movie. In this movie you have only a single check box, but you can use multiple instances of the CheckBox component if you need to. Like the ComboBox component, the CheckBox component has several parameters. You'll look at those parameters, and use them to customize your check box, in this exercise. Be sure you still have guestbook3.fla open from the last exercise before you start.

Select the instance of the CheckBox component on the stage. Type Check here to be added to our mailing list in the Label parameter text box.

You can modify the Label parameter by clicking the default value on its right, and typing the new value in its place. Press Enter or Return after you type the new value, and it should appear on the stage. That is, part of it will appear on the stage—the last few characters may be cut off, as illustrated in the figure below, because the CheckBox instance isn't wide enough for the label. You'll fix that in a moment.

The Label parameter for the CheckBox can have a value of a string, not an array like the ComboBox. You want only a single label for the check box anyway, so that should suffice.

Make sure you still have the CheckBox component selected, and set its width to 300 in the Property inspector.

When you change the width of the CheckBox component instance to 300, the entire label should appear. As with the ComboBox, you can set the width of the CheckBox component, but not its height. The height is controlled by the font used for the label.

You don't have to modify the remaining parameters, as their default values are fine for now. Since you still have the CheckBox component selected, take a quick look at some of the other parameters. The Initial Value parameter specifies whether the check box is initially selected. When this parameter is set to true, the checkbox is selected initially. When it's set to false, it's not selected initially. The value for the Initial Value parameter is a Boolean. The Label Placement parameter, which has a list value type, lets you place the label for the check box on the right or left side. If you click the initial value for this parameter, a list should appear.

The Change Handler parameter, which you might have noticed in the ComboBox component's parameters, lets you specify a function that will run when the value of the component is changed. You don't need to add a Change Handler for either the ComboBox component or the CheckBox component; you are really only concerned with the values (data) specified by those components. However, the Change Handler parameter could be useful if you want to use a component to make something happen in the movie when an option is selected. For example, you could use the ComboBox component to make a menu. When an item in the drop-down list is selected, the function specified in the Change Handler parameter could tell the movie to go to a certain frame, based on which item in the list was selected.

Choose Control > Test Movie.

When you test the movie, you should be able to see the label you set for the check box. You can also click the check box to turn the check on and off. By default, the check box will not be checked.

Save the file as guestbook4.fla in the FlashTFS folder.

Now you need to modify the PushButton components you added to the movie.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint