TextField.wordWrap Property | Flash 6 |
enable automatic line-breaking for long lines | read/write |
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.
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.";
To create a typical multi-paragraph text entry box for user input, set both wordWrap and multiline to true. For example,
this.createTextField("theField_txt", 1, 0, 0, 200, 100); theField_txt.type = "input"; theField_txt.border = true; theField_txt.wordWrap = true; theField_txt.multiline = true; theField_txt.text = "Type input here.";
TextField.multiline, TextField._width