
TextField._x Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
881
TextField.wordWrap Property
enable automatic line-breaking for long lines
Flash 6
read/write
theField.wordWrap
Description
The Boolean wordWrap property enables (true) or disables (false) automatic line-breaking
in
theField. It applies to both user input and text assigned programmatically, and it
defaults to
false. When word-wrapping is enabled, long lines of text soft wrap—that is,
any line that is wider than
theField’s bounding box will automatically flow onto the
following line. This is a display feature only; no carriage return or newline character
appears in the source text where wrapping occurs. When wrapping is disabled, text on long
lines flows beyond
theField’s bounding box and part of the line is hidden. If wordWrap is
true, changing the field’s _width causes long lines to soft wrap at a different point (i.e., the
text reflows). Hard returns can be added to a text field using the
\n escape sequence or
newline constant.
Bugs
In Flash 6, the wordWrap property must be set before any text is assigned to the text field;
otherwise, wrapping may not be applied. For example:
// Set word wrap first
theField_txt.wordWrap = true;
// Now assign text
theField_txt.text = "This is a fairly long line so it might wrap when displayed.";
Example
To