Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > TextField > setNewTextFormat (TextField.setNewTextFormat method) | |||
public setNewTextFormat(tf:TextFormat) : Void
Sets the default new text format of a text field. The default new text format is the new text format 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.
Availability: ActionScript 1.0; Flash Player 6
tf:TextFormat - A TextFormat object.
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";
getNewTextFormat (TextField.getNewTextFormat method), getTextFormat (TextField.getTextFormat method), setTextFormat (TextField.setTextFormat method)
Flash CS3