
TextFormat.leading Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
898
|
ActionScript Language Reference
See Also
TextFormat.bold
TextFormat.leading Property
specifies line spacing
Flash 6
read/write
theFormat.leading
Description
The integer leading property specifies the amount of vertical space between lines of text. It
applies to paragraphs, which are spans of text separated by line break characters specified
in code (
\n, <BR>,ornewline). When leading is 0, the font’s metrics determine the line
spacing. When
leading is any positive integer, it specifies the extra space to add between
lines, in pixels. Negative values for
leading cannot be set via ActionScript but can be set
during authoring with the Properties inspector for text.
To set the leading for an entire text field, invoke TextField.setTextFormat() without speci-
fying any index arguments:
this.createTextField("theField_txt", 1, 0, 0, 50, 60);
theField_txt.border = true;
theField_txt.text = "This is paragraph one.\nThis is paragraph two."
theField_txt.wordWrap = true;
// Create a TextFormat object
format = new TextFormat();
format.leading = 5;
// Apply leading to the whole field
theField_txt.setTextFormat(format);
To set the leading 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 leading for ...