TextSnapshot.hitTestTextNearPos()
795
trace(count); // output: 20
trace(theText); // output: TextSnapshot Example
See also
TextSnapshot.getSelectedText()
TextSnapshot.hitTestTextNearPos()
Availability
Authoring: Flash MX 2004.
Playback: SWF files published for Flash Player 6 or later, playing in Flash Player 7 or later.
Usage
my_snap
.hitTestTextNearPos(
x:Number
,
y:Number
[,
maxDistance:Number
] )
:
Number
Parameters
x
A number that represents the
x
coordinate of the movie clip containing the text in
my_snap
.
y
A number that represents the
x
coordinate of the movie clip containing the text in
my_snap
.
maxDistance
An optional number that represents the maximum distance from
x
,
y
that can be
searched for text. The distance is measured from the centerpoint of each character. The default
value is 0.
Returns
An integer representing the index value of the character in
my_snap
that is nearest to the specified
x
,
y
coordinate. Returns -1 if no character is found, or if the font doesn’t contain character metric
information (see “Description”).
Description
Method; lets you determine which character within a TextSnapshot object is on or near specified
x
,
y
coordinates of the movie clip containing the text in
my_snap
.
If you omit or pass a value of 0 for
maxDistance
, the location specified by the
x
,
y
coordinates
must lie inside the bounding box of
my_snap
.
This method functions correctly only for fonts that include character metric information; by
default, Flash does not include this information for static text fields. In some cases, this behavior
means that the method returns -1 instead of an index value. To ensure that an index 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 character(s) you specify, nor even if they are the characters used
in the static text fields in question.
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...