1262 ActionScript classes
Example
The following example illustrates how to use this method. To use this code, place a static text
field that contains the text "TextSnapshot Example" on the Stage. In the library, include the
font used by the static text field, and in Linkage options for the font, select Export for
ActionScript. To test the code, run the SWF file and point the mouse pointer to the onscreen
text.
var my_ts:TextSnapshot = getTextSnapshot();
this.onMouseMove = function() {
var hitIndex:Number = my_ts.hitTestTextNearPos(_xmouse, _ymouse, 0);
my_ts.setSelected(0, my_ts.getCount(), false);
if (hitIndex >= 0) {
my_ts.setSelected(hitIndex, hi 1, true);
}
};
See also
getTextSnapshot (MovieClip.getTextSnapshot method)
,
_x (MovieClip._x
property)
,
_y (MovieClip._y property)
setSelectColor (TextSnapshot.setSelectColor
method)
public setSelectColor(color:Number) : Void
Specifies the color to use when highlighting characters that were selected with the
TextSnapshot.setSelected()
method. The color is always opaque; you can't specify a
transparency value.
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
-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 characters you specify, nor if
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.
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...