Table of Contents

TextFormat.indent Property Flash 6

specifies indentation for a paragraph's first line read/write
theFormat.indent

Description

The integer indent property specifies the distance a paragraph's first line is indented from the text field's left border, in pixels. Paragraphs are spans of text separated by line break characters specified in code (\n, <BR>, or newline). To set the indentation for all paragraphs in a text field, invoke TextField.setTextFormat( ) without specifying 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.indent = 15;
// Indent the whole field
theField_txt.setTextFormat(format);

To set the indentation for the first paragraph in a text field, apply the format to the character at index 0:

theField_txt.setTextFormat(0, format);

To set the indentation for any subsequent paragraphs, apply the format to the character immediately following the newline character:

// Indent the second paragraph:
theField_txt.setTextFormat(23, format);

To set the indentation for a range of paragraphs, apply the format using start and end index arguments that include the desired paragraphs:

theField_txt.setTextFormat(0, 24, format);

If automatic word-wrapping is disabled for a text field, large values for indent can force text to overflow the text field's right border. If word-wrapping is enabled, large values for indent cause lines to wrap.

The default indent value (as contained in the TextFormat object returned by TextField.getTextFormat( )) for a text field that contains text is 0. For a text field without any text, the indent value is null. For a completely new TextFormat object, it is also null, indicating that indent will not be set when the format is applied to a text field:

trace(anyUnformattedField_txt.getTextFormat().indent);  // Displays: 0
var format = new TextFormat();
trace(format.indent);                                   // Displays: "null"

See Also

TextField.wordWrap, TextFormat.align, TextFormat.blockIndent


Table of Contents