EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - Page 481

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
MovieClip 481
Usage 2: Evaluates the bounding boxes of the target and specified instance, and returns true
if they overlap or intersect at any point.
Parameters
x: Number The x coordinate of the hit area on the Stage. y: Number The y
coordinate of the hit area on the Stage. The x and y coordinates are defined in the global
coordinate space.
shapeFlag: Boolean A Boolean value specifying whether to evaluate the
entire shape of the specified instance (
true), or just the bounding box (false). This
parameter can be specified only if the hit area is identified by using
x and y coordinate
parameters.
target: Object The target path of the hit area that may intersect or overlap
with the movie clip. The
target parameter usually represents a button or text-entry field.
Availability: ActionScript 1.0; Flash Lite 2.0
Returns
Boolean - A Boolean value of true if the movie clip overlaps with the specified hit area,
false otherwise.
Example
The following example uses
hitTest() to determine if the circle_mc movie clip overlaps or
intersects the
square_mc movie clip when the user releases the mouse button:
square_mc.onPress = function() {
this.startDrag();
};
square_mc.onRelease = function() {
this.stopDrag();
if (this.hitTest(circle_mc)) {
trace("you hit the circle");
}
};
See also
getBounds (MovieClip.getBounds method), globalToLocal
(MovieClip.globalToLocal method)
, localToGlobal (MovieClip.localToGlobal
method)

Table of Contents

Related product manuals