TextFormat.blockIndent Property | Flash 6 |
specifies paragraph indentation | read/write |
The integer blockIndent property specifies the distance a paragraph is indented from the text field's left border, in pixels. Paragraphs are spans of text separated by line characters specified in code (\n, <BR>, or newline). To set the indentation for an entire 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.blockIndent = 30; // Block-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 any paragraph wraps to the next line, the specified format range must include the subsequent line's first character; otherwise, the format will not apply to the wrapped line.
If automatic word-wrapping is disabled for a text field, large values for blockIndent can force text to overflow the text field's right border. If word-wrapping is enabled, large values for blockIndent cause lines to wrap. The blockIndent and leftMargin properties are cumulative; for example, if leftMargin is 15 and blockIndent for a paragraph is 10, that paragraph will be indented a total of 25 pixels. Hence, the leftMargin property can be thought of as a field layout tool, while blockIndent can be thought of as a paragraph layout tool.
The default blockIndent 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 blockIndent value is null. For a completely new TextFormat object, it is also null, indicating that blockIndent will not be set when the format is applied to a text field:
trace(anyUnformattedField_txt.getTextFormat().blockIndent); // Displays: 0 var format = new TextFormat(); trace(format.blockIndent); // Displays: "null"
TextField.wordWrap, TextFormat.align, TextFormat.indent, TextFormat.leftMargin, TextFormat.rightMargin