TextSnapshot 1259
Returns
Array
- An array of objects in which each object contains information about a specific
character in the specified range. Each object contains the following properties:
■
indexInRun
A zero-based integer index of the character (relative to the entire string rather
than the selected run of text).
■
selected
A Boolean value that indicates whether the character is selected
true
;
false
otherwise.
■
font
The name of the character's font.
■
color
The combined alpha and color value of the character. The first two hexidecimal
digits represent the alpha value, and the remaining digits represent the color value. (The
example includes a method for converting decimal values to hexidecimal values.)
■
height
The height of the character, in pixels.
■
matrix_a
,
matrix_b
,
matrix_c
,
matrix_d
,
matrix_tx
, and
matrix_ty
The values of a
matrix that define the geometric transformation on the character. Normal, upright text
always has a matrix of the form
[1 0 0 1 x y]
, where
x
and
y
are the position of the
character within the parent movie clip, regardless of the height of the text. The matrix is in
the parent movie clip coordinate system, and does not include any transformations that
may be on that movie clip itself (or its parent).
■
corner0x
,
corner0y
,
corner1x
,
corner1y
,
corner2x
,
corner2y
,
corner3x
, and
corner3y
The corners of the bounding box of the character, based on the coordinate
system of the parent movie clip. These values are only available if the font used by the
character is embedded in the SWF file.
Example
The following example illustrates how to use this method. To use this code, on the Stage
create a static text field that contains the text "AB". Rotate the text field by 45 degrees, and set
the second character to be superscript with a color of 0xFFFFFF with a 50% alpha, as the
following figure shows:
The following script lists the
getTextRunInfo()
properties of each character in the text field:
var myTS:TextSnapshot = this.getTextSnapshot();
var myArray:Array = myTS["getTextRunInfo"](0, myTS.getCount());
for (var i = 0; i < myTS.getCount(); i++) {
trace("indexInRun: " + myArray[i].indexInRun);
trace("selected: " + myArray[i].selected);
trace("font: " + myArray[i].font);
trace("color: " + decToHex(myArray[i].color));
trace("height: " + myArray[i].height);
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...