Hittest (Movieclip.hittest Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

hitTest (MovieClip.hitTest method)

public hitTest() : Boolean
Evaluates the movie clip to see if it overlaps or intersects with the hit area that the
and
coordinate parameters identify.
y
Usage 1: Compares the x and y coordinates to the shape or bounding box of the specified
instance, according to the
actually occupied by the instance on the Stage is evaluated, and if x and y overlap at any point,
a value of
is returned. This evaluation is useful for determining if the movie clip is
true
within a specified hit or hotspot area.
Usage 2: Evaluates the bounding boxes of the
if they overlap or intersect at any point.
Parameters
x: Number
coordinate of the hit area on the Stage. The x and y coordinates are defined in the global
coordinate space.
shapeFlag: Boolean
entire shape of the specified instance (
parameter can be specified only if the hit area is identified by using
parameters.
target: Object
with the movie clip. The
Availability: ActionScript 1.0; Flash Player 5
Returns
- A Boolean value of
Boolean
otherwise.
false
Example
The following example uses
intersects the
square_mc
square_mc.onPress = function() {
this.startDrag();
};
square_mc.onRelease = function() {
this.stopDrag();
if (this.hitTest(circle_mc)) {
trace("you hit the circle");
}
};
880
ActionScript classes
setting. If
shapeFlag
The x coordinate of the hit area on the Stage.
A Boolean value specifying whether to evaluate the
), or just the bounding box (
true
The target path of the hit area that may intersect or overlap
parameter usually represents a button or text-entry field.
target
if the movie clip overlaps with the specified hit area,
true
to determine if the
hitTest()
movie clip when the user releases the mouse button:
is set to
shapeFlag
and specified instance, and returns
target
circle_mc
target
, only the area
true
true
The y
y: Number
). This
false
and
coordinate
x
y
movie clip overlaps or
or
x

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF