
TextFormat.indent Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
896
|
ActionScript Language Reference
// Assume the string is too wide to fit
var tooWide = true;
// Check if our assumption is correct
for (var i = theSubstring.length - 1; tooWide = = true && i > 0; i--) {
// If the string is too wide to fit in the field...
if (format.getTextExtent(theSubstring).width > textRegion) {
// ...remove a character, add an ellipsis, then check again.
theSubstring = theText.substr(0, i) + "...";
} else {
// ...otherwise, the string will fit, so stop checking.
tooWide = false;
}
}
// Assign the corrected string to the text field
this.text = theSubstring;
}
// Sample use of setEllipsisText()
this.createTextField("theField_txt", 1, 100, 100, 150, 60);
theField_txt.border = true;
theField_txt.setEllipsisText("If this text is too long it will be truncated.");
See Also
TextField.border, TextField._height, TextField.textHeight, TextField.textWidth,
TextField._width, TextFormat.size
TextFormat.indent Property
specifies indentation for a paragraph’s first line
Flash 6
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>,ornewline).