776
Chapter 7: ActionScript for Flash
TextFormat class
Availability
Flash Player 6.
Description
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:
this.createTextField("my_txt", this.getNextHighestDepth(), 0, 0, 100, 22);
my_txt.autoSize = true;
my_txt.text = "Lorem ipsum dolor sit amet...";
var my_fmt:TextFormat = new TextFormat();
my_fmt.bold = true;
my_txt.setTextFormat(my_fmt);
This code first creates an empty TextFormat object with all of its properties
null
, and 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 summary for the TextFormat class
Property summary for the TextFormat class
Method
Description
TextFormat.getTextExtent()
Returns text measurement information for a text string.
Property
Description
TextFormat.align
Indicates the alignment of a paragraph.
TextFormat.blockIndent
Indicates the block indentation, in points.
TextFormat.bold
Indicates whether text is boldface.
TextFormat.bullet
Indicates whether text is in a bulleted list.
TextFormat.color
Indicates the color of text.
TextFormat.font
Indicates the font name of the text with a text format.
CHAPTER 7
ActionScript for Flash
Содержание FLEX-FLEX ACTIONSCRIPT LANGUAGE
Страница 1: ...Flex ActionScript Language Reference...
Страница 8: ......
Страница 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Страница 76: ......
Страница 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Страница 135: ...case 135 See also break default strict equality switch...
Страница 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Страница 229: ...while 229 i 3 The following result is written to the log file 0 3 6 9 12 15 18 See also do while continue for for in...
Страница 808: ...808 Chapter 7 ActionScript for Flash...
Страница 810: ...810 Appendix A Deprecated Flash 4 operators...
Страница 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Страница 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Страница 822: ...822 Index...