03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - 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.

hitArea (MovieClip.hitArea property)<br />

public hitArea : Object<br />

Designates another movie clip to serve as the hit area for a movie clip. If the hitArea property<br />

does not exist or the value is null or undefined, the movie clip itself is used as the hit area.<br />

The value of the hitArea property may be a reference to a movie clip instance.<br />

You can change the hitArea property at any time; the modified movie clip immediately uses<br />

the new hit area behavior. The movie clip designated as the hit area does not need to be<br />

visible; its graphical shape, although not visible, is still detected as the hit area.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Example<br />

The following example sets the circle_mc movie clip as the hit area for the square_mc movie<br />

clip. Place these two movie clips on the Stage <strong>and</strong> test the document. When you click<br />

circle_mc, the square_mc movie clip traces that it was clicked.<br />

square_mc.hitArea = circle_mc;<br />

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

trace("hit! "+this._name);<br />

};<br />

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. The method signature for this usage is:<br />

public hitTest(x:Number, y:Number, [shapeFlag:Boolean]):Boolean<br />

MovieClip 891

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

Saved successfully!

Ooh no, something went wrong!