TextField.setTextFormat()
749
Description
Method; sets the default new text format of a text field; that is, the text format to be used for
newly inserted text, such as text inserted with the
replaceSel()
method or text entered by a
user. When text is inserted, the newly inserted text is assigned the default new text format.
The new default text format is specified by
textFormat
, which is a TextFormat object.
Example
In the following example, a new text field (called
my_txt
) is created at runtime and several
properties are set. The format of the newly inserted text is applied.
var my_fmt:TextFormat = new TextFormat();
my_fmt.bold = true;
my_fmt.font = "Arial";
my_fmt.color = 0xFF9900;
this.createTextField("my_txt", 999, 0, 0, 400, 300);
my_txt.wordWrap = true;
my_txt.multiline = true;
my_txt.border = true;
my_txt.type = "input";
my_txt.setNewTextFormat(my_fmt);
my_txt.text = "Oranges are a good source of vitamin C";
See also
TextField.getNewTextFormat()
,
TextField.getTextFormat()
,
TextField.setTextFormat()
TextField.setTextFormat()
Availability
Flash Player 6.
Usage
my_txt
.setTextFormat (
textFormat:TextFormat
)
: Void
my_txt
.setTextFormat (
index:Number
,
textFormat:TextFormat
)
: Void
my_txt
.setTextFormat (
beginIndex:Number
,
endIndex:Number
,
textFormat:TextFormat
)
: Void
Parameters
textFormat
A TextFormat object, which contains character and paragraph formatting
information.
index
An integer that specifies a character within
my_txt
.
beginIndex
An
integer.
endIndex
An integer that specifies the first character after the desired text span.
Returns
Nothing.
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...