MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 1261

Actionscript 2.0 language reference
Table of Contents

Advertisement

See also
Matrix (flash.geom.Matrix)
hitTestTextNearPos
(TextSnapshot.hitTestTextNearPos method)
public hitTestTextNearPos(x:Number, y:Number, [closeDist:Number]) : Number
Lets you determine which character within a TextSnapshot object is on or near the specified x,
y coordinates of the movie clip containing the text in the TextSnapshot object.
If you omit or pass a value of
must lie inside the bounding box of the TextSnapshot object.
This method works correctly only with fonts that include character metric information;
however, by default, Macromedia Flash does not include this information for static text fields.
Therefore, the method might return
value is returned, you can force the Flash authoring tool to include the character metric
information for a font. To do this, add a dynamic text field that uses that font, select
Character Options for that dynamic text field, and then specify that font outlines should be
embedded for at least one character. (It doesn't matter which characters you specify, nor
whether they are the characters used in the static text fields.)
Availability: ActionScript 1.0; Flash Player 7 - The SWF file must be published for Flash
Player 6 or later, and must be played in Flash Player 7 or later.
Parameters
- The x coordinate of the movie clip that contains the text in the TextSnapshot
x:Number
object.
- The y coordinate of the movie clip that contains the text in the TextSnapshot
y:Number
object.
[optional] - The maximum distance from x, y that can be searched for
closeDist:Number
text. The distance is measured from the centerpoint of each character. The default value is
Returns
- The index value of the character in the TextSnapshot object that is nearest to the
Number
specified x, y coordinate. The method returns
contain character metric information.
for
, the location specified by the x, y coordinates
0
closeDist
instead of an index value. To ensure that an index
-1
if no character is found, or if the font doesn't
-1
.
0
TextSnapshot
1261

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents