03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - 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.

Example<br />

In this example, you need to create a dynamic text field called my_txt, <strong>and</strong> then use the<br />

following ActionScript to embed fonts <strong>and</strong> rotate the text field. The string my font refers to a<br />

font symbol in the library, with the linkage identifier name my font. The example assumes<br />

that you have a font symbol in the library called my font, with linkage properties set as<br />

follows: the identifier set to my font <strong>and</strong> Export for ActionScript <strong>and</strong> Export in First Frame<br />

selected.<br />

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

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

this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 160,<br />

120);<br />

my_txt.wordWrap = true;<br />

my_txt.embedFonts = true;<br />

my_txt.text = "Hello world";<br />

my_txt.setTextFormat(my_fmt);<br />

my_txt._rotation = 45;<br />

getDepth (TextField.getDepth method)<br />

public getDepth() : Number<br />

Returns the depth of a text field.<br />

Returns<br />

Number - An integer.<br />

Example<br />

The following example demonstrates text fields residing at different depths. Create a dynamic<br />

text field on the Stage. Add the following ActionScript to your FLA or ActionScript file,<br />

which dynamically creates two text fields at runtime <strong>and</strong> outputs their depths.<br />

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

22);<br />

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

22);<br />

for (var prop in this) {<br />

if (this[prop] instanceof TextField) {<br />

var this_txt:TextField = this[prop];<br />

trace(this_txt._name+" is a TextField at depth: "+this_txt.getDepth());<br />

}<br />

}<br />

TextField 621

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

Saved successfully!

Ooh no, something went wrong!