
TextFormat.align Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
889
Usage
Writing to the text property of a TextField object destroys any custom formatting associ-
ated with the field. Use the TextField.replaceSel() method to add text to a field while
retaining its formatting.
See Also
TextField.getNewTextFormat(), TextField.getTextFormat(), TextField.htmlText, TextField.
replaceSel(), TextField.setNewTextFormat(), TextField.setTextFormat(), the TextField class
TextFormat.align Property
specifies horizontal paragraph alignment
Flash 6
read/write
theFormat.align
Description
The string align property specifies whether text is positioned at the “left”, “right”, or
“center” of a text field. It applies to paragraphs, which are spans of text separated by line
break characters specified in code (
\n, <BR>, <P>,ornewline). To set the alignment for an
entire text field, apply the text format by invoking TextField.setTextFormat() without speci-
fying any index arguments:
this.createTextField("theField_txt", 1, 0, 0, 200, 60);
theField_txt.border = true;
theField_txt.text = "This is paragraph one.\nThis is paragraph two."
// Create a TextFormat object
format = new TextFormat();
format.align = "center";
// Center the whole field
theField_txt.setTextFormat(format);
To set the alignment for the first paragraph in a ...