03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

this.createTextField("date_txt", this.getNextHighestDepth(), 10, 10, 100,<br />

22);<br />

date_txt.autoSize = true;<br />

date_txt.selectable = true;<br />

var date_interval:Number = setInterval(updateTime, 500, date_txt);<br />

function updateTime(my_txt:TextField) {<br />

my_txt.text = new Date().toString();<br />

}<br />

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player<br />

7 or later. If your SWF file includes a version 2 component, use the version 2 components'<br />

DepthManager class instead of the MovieClip.getNextHighestDepth() method.<br />

setNewTextFormat (TextField.setNewTextFormat<br />

method)<br />

public setNewTextFormat(tf:TextFormat) : Void<br />

Sets the default new text format of a text field. The default new text format is the new text<br />

format used for newly inserted text such as text inserted with the replaceSel() method or<br />

text entered by a user. When text is inserted, the newly inserted text is assigned the default<br />

new text format.<br />

The new default text format is specified by textFormat, which is a TextFormat object.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Parameters<br />

tf:TextFormat - A TextFormat object.<br />

Example<br />

In the following example, a new text field (called my_txt) is created at runtime <strong>and</strong> several<br />

properties are set. The format of the newly inserted text is applied.<br />

var my_fmt:TextFormat = new TextFormat();<br />

my_fmt.bold = true;<br />

my_fmt.font = "Arial";<br />

my_fmt.color = 0xFF9900;<br />

this.createTextField("my_txt", 999, 0, 0, 400, 300);<br />

my_txt.wordWrap = true;<br />

my_txt.multiline = true;<br />

my_txt.border = true;<br />

my_txt.type = "input";<br />

my_txt.setNewTextFormat(my_fmt);<br />

my_txt.text = "Oranges are a good source of vitamin C";<br />

TextField 1227

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!