
TextField.setTextFormat() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
868
|
ActionScript Language Reference
When text is inserted with the replaceSel() method, it’s easy to force the appropriate new
text format—simply invoke setNewTextFormat() after the call to Selection.setSelection(),as
shown in Example R-9.
See Also
The Selection class, TextField.getTextFormat(), TextField.getNewTextFormat(), TextField.
replaceSel(), TextField.setTextFormat(), the TextFormat class
TextField.setTextFormat() Method
sets the formatting for a specified range of characters
Flash 6
theField.setTextFormat(textFormatObject)
theField.setTextFormat(beginIndex, textFormatObject)
theField.setTextFormat(beginIndex, endIndex, textFormatObject)
Arguments
textFormatObject
An instance of the TextFormat class.
beginIndex The index of the first character whose formatting will be set by
textFormatObject. Must be a nonnegative integer.
endIndex The index following the last character whose formatting will be set by
textFormatObject. Must be a nonnegative integer.
} else if (oldFocus = = this) {
// Stop resetting if the field is unfocused
clearInterval(this.restoreInterval);
}
}
// Create the interval function to reset the newTextFormat
theField_txt.restoreNewTextFormat = function () {
this.setNewTextFormat(this.newTextFormat);
}
// Register the text field to receive ...