![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
Flash Player 6.
The TextFormat class represents character formatting information.
You must use the constructor new TextFormat()
to create a TextFormat object before calling its methods.
You can set TextFormat parameters to null
to indicate that they are undefined. When you apply a TextFormat object to a text field using TextField.setTextFormat()
, only its defined properties are applied, as in the following example:
my_fmt = new TextFormat(); my_fmt.bold = true; my_txt.setTextFormat(my_fmt);
This code first creates an empty TextFormat object with all of its properties undefined, then sets the bold
property to a defined value.
The code my_txt.setTextFormat(my_fmt)
only changes the bold
property of the text field's default text format, because the bold
property is the only one defined in my_fmt
. All other aspects of the text field's default text format remain unchanged.
When TextField.getTextFormat()
is invoked, a TextFormat object is returned with all of its properties defined; no property is null
.
Method |
Description |
---|---|
Returns text measurement information for a text string. |
Property |
Description |
---|---|
Indicates the alignment of a paragraph. |
|
Indicates the block indentation, in points. |
|
Indicates whether text is boldface. |
|
Indicates whether text is in a bulleted list. |
|
Indicates the color of text. |
|
Indicates the font name of the text with a text format. |
|
Indicates the indentation from the left margin to the first character in the paragraph. |
|
Indicates whether text is italicized. |
|
Indicates the amount of vertical space (called leading) between lines. |
|
Indicates the left margin of the paragraph, in points. |
|
Indicates the right margin of the paragraph, in points. |
|
Indicates the point size of text. |
|
Specifies custom tab stops. |
|
Indicates the window in a browser where a hyperlink is displayed. |
|
Indicates whether text is underlined. |
|
Indicates the URL to which the text links. |
Flash Player 6.
new TextFormat([
font
,
[size
,
[color
,
[bold
,
[italic
, [
underline
,
[url
,
[target
, [
align
,
[leftMargin
, [
rightMargin
,
[indent
,
[leading
]]]]]]]]]]]]])
font
The name of a font for text as a string.
size
An integer that indicates the point size.
color
The color of text using this text format. A number containing three 8-bit RGB components; for example, 0xFF0000 is red, 0x00FF00 is green.
bold
A Boolean value that indicates whether the text is boldface.
italic
A Boolean value that indicates whether the text is italicized.
underline
A Boolean value that indicates whether the text is underlined.
url
The URL to which the text in this text format hyperlinks. If url
is an empty string, the text does not have a hyperlink.
target
The target window where the hyperlink is displayed. If the target window is an empty string, the text is displayed in the default target window _self
. If the url
parameter is set to an empty string or to the value null
, you can get or set this property, but the property will have no effect.
align
The alignment of the paragraph, represented as a string. If "left"
, the paragraph is left-aligned. If "center"
, the paragraph is centered. If "right"
, the paragraph is right-aligned.
leftMargin
Indicates the left margin of the paragraph, in points.
rightMargin
Indicates the right margin of the paragraph, in points.
indent
An integer that indicates the indentation from the left margin to the first character in the paragraph.
leading
A number that indicates the amount of leading vertical space between lines.
Nothing.
Constructor; creates a TextFormat object with the specified properties. You can then change the properties of the TextFormat object to change the formatting of text fields.
Any parameter may be set to null
to indicate that it is not defined. All of the parameters are optional; any omitted parameters are treated as null
.
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |