
MovieClip.hitArea Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
665
Example
ball_mc._height = 20; // Set the height of ball_mc to 20 pixels
ball_mc._height /= 2; // Reduce the height of ball_mc by a factor of 2
See Also
MovieClip._width, MovieClip._yscale, Stage.height
MovieClip.hitArea Property
assigns the hotspot for a button-enabled movie clip
Flash 6
read/write
mc.hitArea
Description
The hitArea property is used only with movie clips that define button event handlers (e.g.,
onPress(), onRelease(), etc.). It sets
mc’s button hit area—the physical region that must be
under the mouse pointer in order for the button to be activated by a mouseclick. When the
value of
hitArea is null or undefined, the shape of mc’s content is used as the hit area. When
the value of
hitArea is a reference to a movie clip, the shape of that clip’s content is used as
mc’s hit area. The hitArea clip can move, be invisible, or even be reassigned at any time,
allowing great flexibility for dynamically generated buttons. For example, an animated
button can have a hit area that changes size with the animation, or a button can have a
different hit area for its Over, Up, and Down states.
The movie clip used as the
hitArea for mc can reside on any clip’s timeline, including mc’s.
For example:
// Set button_mc's hit area to a clip ...