beautypg.com

Document.settextrectangle(), Document.settextselection() – Adobe Extending Flash Professional CS5 User Manual

Page 178

background image

156

EXTENDING FLASH PROFESSIONAL

Document object

Last updated 5/2/2011

document.setTextRectangle()

Availability
Flash MX 2004.

Usage

document.setTextRectangle(boundingRectangle)

Parameters

boundingRectangle

A rectangle that specifies the new size within which the text item should flow. For information

on the format of boundingRectangle, see

document.addNewRectangle()

.

Returns
A Boolean value:

true

if the size of at least one text field is changed;

false

otherwise.

Description
Method; changes the bounding rectangle for the selected text item to the specified size. This method causes the text to
reflow inside the new rectangle; the text item is not scaled or transformed. The values passed in boundingRectangle are
used as follows:

If the text is horizontal and static, the method takes into account only the width value passed in boundingRectangle;
the height is automatically computed to fit all the text.

If the text is vertical (and therefore static), the method takes into account only the height value passed in
boundingRectangle; the width is automatically computed to fit all the text.

If the text is dynamic or input, the method takes into account both the width and height values passed in
boundingRectangle, and the resulting rectangle might be larger than needed to fit all the text. However, if the
parameters specify a rectangle size that is too small to fit all the text, the method takes into account only the width
value passed in boundingRectangle (the height is automatically computed to fit all the text).

Example
The following example changes the size of the bounding text rectangle to the specified dimensions:

fl.getDocumentDOM().setTextRectangle({left:0, top:0, right:50, bottom:200})

document.setTextSelection()

Availability
Flash MX 2004.

Usage

document.setTextSelection(startIndex, endIndex)

Parameters

startIndex

An integer that specifies the position of the first character to select. The first character position is 0

(zero).

This manual is related to the following products: