You want to define a hit area for a movie clip used as a button.
Create a second movie clip to serve as the hit area. Then assign a
reference to the hit area movie clip to the
hitArea property of the button movie clip.
When you create button symbols at authoring time, you can create
alternate hit areas using the
Hit frame of the
button’s timeline. This can be very useful if the
artwork in the button is not solid or if you want to define a hit
area that is otherwise different from the shape defined by the
You can also define hit areas for movie clips used as buttons. All
movie clips have a built-in property named
hitArea is left
undefined, Flash automatically uses the movie clip’s
artwork as the hit area. However, you can assign the
hitArea property a reference to another movie clip
to serve as the hit area.
The following example shows how a custom hit area can be useful when
dealing with odd shapes or outlines. Using code, we generate a movie
clip that contains 100 small, unfilled circles that are aligned to
form a square grid. We then assign an
) event handler method to the movie clip instance. Testing
the code reveals that the movie clip’s rollover
state is activated only when the mouse pointer is directly over one
of the circle outlines.
// Include the
DrawingMethods.asfile from Chapter 4 for its
drawCircle( )method. #include "DrawingMethods.as" // Create the button movie ...