03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

You can also set the circle_mc movie clip visible property to false to hide the hit area for<br />

square_mc.<br />

circle_mc._visible = false;<br />

See also<br />

hitTest (MovieClip.hitTest method)<br />

hitTest (MovieClip.hitTest method)<br />

public hitTest() : Boolean<br />

Evaluates the movie clip to see if it overlaps or intersects with the hit area that the target or x<br />

<strong>and</strong> y coordinate parameters identify.<br />

Usage 1: Compares the x <strong>and</strong> y coordinates to the shape or bounding box of the specified<br />

instance, according to the shapeFlag setting. If shapeFlag is set to true, only the area<br />

actually occupied by the instance on the Stage is evaluated, <strong>and</strong> if x <strong>and</strong> y overlap at any point,<br />

a value of true is returned. This evaluation is useful for determining if the movie clip is<br />

within a specified hit or hotspot area.<br />

Usage 2: Evaluates the bounding boxes of the target <strong>and</strong> specified instance, <strong>and</strong> returns true<br />

if they overlap or intersect at any point.<br />

Parametersx: Number The x coordinate of the hit area on the Stage. y: Number The y<br />

coordinate of the hit area on the Stage. The x <strong>and</strong> y coordinates are defined in the global<br />

coordinate space. shapeFlag: Boolean A Boolean value specifying whether to evaluate the<br />

entire shape of the specified instance (true), or just the bounding box (false). This<br />

parameter can be specified only if the hit area is identified by using x <strong>and</strong> y coordinate<br />

parameters. target: Object The target path of the hit area that may intersect or overlap<br />

with the movie clip. The target parameter usually represents a button or text-entry field.<br />

Returns<br />

Boolean - A Boolean value of true if the movie clip overlaps with the specified hit area,<br />

false otherwise.<br />

Example<br />

The following example uses hitTest() to determine if the circle_mc movie clip overlaps or<br />

intersects the square_mc movie clip when the user releases the mouse button:<br />

square_mc.onPress = function() {<br />

this.startDrag();<br />

};<br />

square_mc.onRelease = function() {<br />

this.stopDrag();<br />

438 ActionScript classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!