1228 ActionScript classes
Example
See the example for
TextField._xscale
.
See also
_x (TextField._x property)
,
_xscale (TextField._xscale property)
,
_y
(TextField._y property)
TextFormat
Object
|
+-TextFormat
public class
TextFormat
extends Object
The TextFormat class represents character formatting information. Use the TextFormat class
to create specific text formatting for text fields. You can apply text formatting to both static
and dynamic text fields. Some properties of the TextFormat class are not available for both
embedded and device fonts.
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
MovieClip.getNextHighestDepth()
method
used in this example requires Flash Player 7 or later. If your SWF file includes a version 2
component, use the version 2 components DepthManager class instead of the
MovieClip.getNextHighestDepth()
method.
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.
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...