![MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference Download Page 776](http://html1.mh-extra.com/html/macromedia/flex-flex-actionscript-language/flex-flex-actionscript-language_reference_3387192776.webp)
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
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...