TextSnapshot 1263
Parameters
color
:Number
- The color used for the border placed around characters that have been
selected by the corresponding
TextSnapshot.setSelected()
method, expressed in
0x
RRGGBB
format.
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. Add the following ActionScript to Frame 1 of the Timeline:
var my_snap:TextSnapshot = this.getTextSnapshot();
var count:Number = my_snap.getCount();
my_snap.setSelectColor(0xFF0000);
my_snap.setSelected(0, 4, true);
my_snap.setSelected(1, 2, false);
var theText:String = my_snap.getSelectedText(false); // get the selected
text
trace(theText); // Text
When you test the SWF file, you see a colored rectangle surrounds the specified characters.
See also
setSelected (TextSnapshot.setSelected method)
setSelected (TextSnapshot.setSelected method)
public setSelected(start:Number, end:Number, select:Boolean) : Void
Specifies a range of characters in a TextSnapshot object to be selected or not. Characters that
are selected are drawn with a colored rectangle behind them, matching the bounding box of
the character. The color of the bounding box is defined by
TextSnapshot.setSelectColor()
.
To select or deselect all characters, pass a value of
0
for
start
and
TextSnapshot.getCount()
(or any very large number) for
end
. To specify a single character,
pass a value of
start + 1
for
end
.
Because characters are individually marked as selected, you can call this method multiple
times to select multiple characters; that is, using this method does not deselect other
characters that have been set by this method.
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...