Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Adobe Creative Suite

  • Print
  • + Share This


The first thing you need to define to add interactivity to your presentation is the event, which you can trigger in one of in two ways: deliberately—meaning something or someone initiates the event by clicking a button, dialing a number, or performing an action—or based on time—meaning the event is initiated when a set amount of time has passed. In Flash these are known as mouse/keyboard events (initiated by the user) and frame events (initiated when the timeline reaches a frame during playback).

Mouse events (button actions)

Mouse events occur when your audience interacts with a button instance in your movie. Such events are also known as button actions because they are always attached to buttons and they always trigger an action. A user can employ the pointer in any of the following ways to trigger a mouse event (Figure 1):

    Press. Action is triggered when the user moves the pointer over a movie button and presses the mouse button.

    Release. Action is triggered when the user moves the pointer over a movie button and clicks and releases the mouse button. (This is the default event for most actions.)

    Release Outside. Action is triggered when the user presses a movie button but releases the mouse away from the button.

    Roll Over. Action occurs when the user moves the pointer over a movie button.

    Roll Out. Action occurs when the user moves the pointer away from a button.

    Drag Over. Action occurs when the user places the pointer over a movie button while pressing the mouse button, then drags the pointer away from the movie button (while still pressing the mouse button), and finally moves back over the movie button.

    Drag Out. Action occurs when user places the pointer over a movie button, presses the mouse button, and drags away from the movie button (while still pressing mouse button).

Buttons are the only objects in your movie that are affected by these events.

Figure 1

The down arrow represents the mouse button being pressed down; the up arrow represents it being released. No arrow represents a mouse event that doesn't require the mouse button to be pressed or released.

To define a mouse event that triggers an action:

  1. Double-click a button instance, or select a button instance and from the Modify menu choose Instance.

    The Instance Properties dialog box appears.

  2. Click the Action tab.

  3. Click the plus sign ("+") to assign an action or actions you want triggered on the mouse event.

  4. For our demonstration, choose the Stop action to halt your movie.

    The Actions pane shows your completed ActionScript (Figure 2), which indicates that the action will occur when the button is released. This is the default mouse event Flash assigns to an action when you don't specifically choose one. This may not be the mouse event you want to trigger the action, or you may want to use more than one mouse event to trigger it. Let's configure the mouse event more to our liking.

    Figure 2

    ActionScript for making a mouse event trigger the movie to stop.

  5. In the Actions pane select the On (Release) statement.

    It becomes highlighted, and mouse event parameters become available on the right side of the Action dialog box (Figure 3).

    Figure 3

    Mouse event parameters.

  6. Check any mouse events you want to trigger this action.

    As you check various events, the On () statement is updated in the Parameter pane.

  7. Click OK.

    When the movie is played, the action you assigned to this button will be performed when any of the mouse events you checked are triggered.

TIP  Mouse events assigned to one instance of a button have no effect on other instances of the button—even if they're all on the stage at the same time. Each button instance can be assigned different events and actions.

TIP  You can, if you wish, assign the mouse event before you assign an action to it. Perform Steps 1 and 2 above, but in Step 3 select On MouseEvent to define the mouse event. Then, from the same menu, select an action (Figure 4).

Figure 4

Choose the On MouseEvent option first to assign mouse events before setting up an action.

TIP  Many button actions cannot be tested in the authoring environment. To test buttons completely, choose Control > Test Movie.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.