Creating Buttons on the Stage
With the tools in the Tool palette, you can create working push buttons, check boxes, and radio buttons, along with the text that accompanies them ( Figure 9.24 ). For a description of each of these kinds of buttons, see the sidebar, "Button Types."
Figure 9.24. Use these tools to create push buttons, check boxes, and radio buttons for your movie.
When you play back your movie, you can click the buttons and they'll respond to your clicks (for example, an X will appear in a check box), but they won't actually do anything. In order for a button to accomplish a task, you have to assign a behavior to it (see Chapter 14, "Adding Behaviors") or attach a script to it (see Chapter 15, "Scripting Lingo").
Note that these buttons are fairly primitive graphically. They're based on the buttons used in early versions of the Mac operating systempure black and white, with none of the shading or 3D effects that are typical of present-day buttons. The push button, in particular, is probably too old-fashioned-looking to be useful. Instead, you'll probably want to create or import your own push-button cast members and attach a button behavior to them. (See Chapter 14, "Adding Behaviors.")
A push button is what most of us have in mind when we simply refer to "a button" ( Figure 9.25 ). It's an object that may or may not look like a physical button, but it performs a specific action when clicked.
Figure 9.25. Add a push button to your movie if you want an action performed when a button is clicked.
Clicking a check box causes an X to appear in the center of the box. It's possible to select more than one check box in a group , so that any number (including all or none) of the boxes may end up with X 's in them ( Figure 9.26 ). Check boxes usually appear in groups, allowing a user to select any number of options, though a single check box may be used in a yes-or-no situation.
Figure 9.26. Add check boxes to your movie when you want users to select any number of options.
Radio buttons always occur in groups. Clicking a radio button causes a dot to appear in its center and causes the dot to disappear in any other buttons in the group. Thus, only one radio button can be chosen at a time ( Figure 9.27 ). Radio buttons require a user to make a single choice from among several options.
Figure 9.27. Add radio buttons to your movie when you want your users to choose only one option.
To create a button or check box:
Depending on your preference, click the radio button, push button, or check box tool in the Tool palette.
On the Stage, drag horizontally to create the button. Drag a rectangle big enough to contain not just the button but the text label that accompanies it ( Figure 9.28 ).
Figure 9.28. Drag a rectangle big enough to hold not just the button but a text label as well.
Check boxes and radio buttons are always the same size no matter how far you drag. You can change the width of push buttons by dragging farther, but the height remains the same.
Release the mouse button.
A blinking insertion point appears at the place where the text label will go. If you're creating a push button, the insertion point is inside the button; if you're creating a check box or radio button, the insertion point is to the right.
If you wish, select the font, size, and style for the text label: Choose Modify > Font and use the Font dialog box; alternatively, you can specify these text settings in the Text Inspector.
For more information about each of these options, see Chapter 12, "Adding Text."
Type the text ( Figure 9.29 ).
Figure 9.29. Type the text that goes with the button.
If you need more room for the text, expand the rectangle by dragging the gray striped border that surrounds it.
The text inside will automatically rewrap ( Figure 9.30 ).
Figure 9.30. Resize the rectangle if necessary to accommodate the text.
Click outside the rectangle.
The button and text become a sprite on the Stage and are added to the Cast window.