03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

■ color—The combined alpha <strong>and</strong> color value of the character. The first two hexadecimal<br />

digits represent the alpha value, <strong>and</strong> the remaining digits represent the color value. (The<br />

example includes a method for converting decimal values to hexadecimal values.)<br />

■ height—The height of the character, in pixels.<br />

■ matrix_a, matrix_b, matrix_c, matrix_d, matrix_tx, <strong>and</strong> matrix_ty— The values of<br />

a matrix that define the geometric transformation on the character. Normal, upright text<br />

always has a matrix of the form [1 0 0 1 x y], where x <strong>and</strong> y are the position of the<br />

character within the parent movie clip, regardless of the height of the text. The matrix is in<br />

the parent movie clip coordinate system, <strong>and</strong> does not include any transformations that<br />

may be on that movie clip itself (or its parent).<br />

■ corner0x, corner0y, corner1x, corner1y, corner2x, corner2y, corner3x, <strong>and</strong><br />

corner3y—The corners of the bounding box of the character, based on the coordinate<br />

system of the parent movie clip. These values are only available if the font used by the<br />

character is embedded in the SWF file.<br />

Example<br />

The following example illustrates how to use this method. To use this code, on the Stage<br />

create a static text field that contains the text "AB". Rotate the text field by 45 degrees, <strong>and</strong> set<br />

the second character to be superscript with a color of 0xFFFFFF with a 50% alpha, as the<br />

following figure shows:<br />

The following script lists the getTextRunInfo() properties of each character in the text field:<br />

var myTS:TextSnapshot = this.getTextSnapshot();<br />

var myArray:Array = myTS["getTextRunInfo"](0, myTS.getCount());<br />

for (var i = 0; i < myTS.getCount(); i++) {<br />

trace("indexInRun: " + myArray[i].indexInRun);<br />

trace("selected: " + myArray[i].selected);<br />

trace("font: " + myArray[i].font);<br />

trace("color: " + decToHex(myArray[i].color));<br />

trace("height: " + myArray[i].height);<br />

trace("matrix_a: " + myArray[i].matrix_a);<br />

trace("matrix_b: " + myArray[i].matrix_b);<br />

trace("matrix_c: " + myArray[i].matrix_c);<br />

trace("matrix_d: " + myArray[i].matrix_d);<br />

trace("matrix_ty: " + myArray[i].matrix_tx);<br />

trace("matrix_tx: " + myArray[i].matrix_ty);<br />

trace(" ");<br />

}<br />

function decToHex(dec:Number) {<br />

var hexString:String = "";<br />

1280 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!