#91. Creating Buttons
Adding hyperlinks is one way to add interactivity to InDesign documents that you export as PDF documents. Adding buttons is another. Buttons are similar to hyperlinks in that you can configure them to jump to other pages within the document, other documents, and URLs; however, buttons can also perform other actions, such as playing a movie or a sound, opening a file, or changing the view magnification.
If you want to make a button in a PDF document look and behave more like a real-world button, you can configure it to display different graphics when a viewer moves the pointer over it or clicks it. The controls in the States palette (Window > Interactive > States) include three default button stylesBevel, Drop Shadow, and Glowor you can create custom styles. When you create a custom button style, you can assign a graphic or text to each of three mouse actions: Up (when the pointer is not over the button), Rollover (when the pointer is over the button), and Down (when a viewer clicks the button). You don't have to assign content for all three states. For example, you could configure a button that ignores a rollover and changes appearance only when a viewer clicks it.
To create a button:
Select the object you want to use as a button and choose Object > Interactive > Convert to Button.
With the object selected, choose Object > Interactive > Button Options. Use the controls in the General panel of the Button Options dialog box (Figure 91) to enter a name, add a description, and specify the button's visibility in the PDF.
Figure 91. In this example, the Play button beneath the movie frame is configured to play when somebody clicks it (Event > Mouse Up). The controls in the Behaviors panel determine what happens when an Acrobat or Reader user interacts with the Play button.
Click Behaviors. The controls in the Behaviors panel let you specify what happens when the button is clicked in the PDF.
Choose a mouse actionMouse Up, Mouse Down, Mouse Enter, or Mouse Exitfrom the Event menu that will trigger the action. (The On Focus event lets you perform an action when a viewer of the PDF file presses the Tab key to select the button; the On Blur event lets you perform an action when a viewer presses Tab to select a different button or field.)
Choose an option from the Behavior menu. The action you choose in the Behavior menu determines the controls displayed. For example, if you choose Movie or Sound, you can select the movie or sound you want to play and specify play options. (See #92 for information about working with movies and sounds.)
Adjust the controls for the selected behavior. When you're done choosing settings, make sure you click Add to add the action to the scroll list.
When you finish specifying the behavior of the button, click OK.
If you want, you can add multiple mouse events with different behaviors, and you can add multiple behaviors to a single mouse event. For example, you could configure a single button that plays a sound when a PDF user moves the pointer within the button (Mouse Enter) and plays a movie when a viewer clicks the button (Mouse Up). Click Add each time you want to add Event/Behavior settings.
If you've included buttons in an InDesign document, make sure you check Include Interactive Elements in the General panel of the Export Adobe PDF dialog box when you export the document as PDF. For information about exporting InDesign documents as PDF, see #95.