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 />

The following example creates a new text field at runtime, <strong>and</strong> puts a string with a line break<br />

into the field. The TextFormat class is used to format the characters by adding bullets to each<br />

line in the text field. This is demonstrated in the following ActionScript:<br />

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

my_fmt.bullet = true;<br />

this.createTextField("my_txt", 1, 100, 100, 300, 100);<br />

my_txt.multiline = true;<br />

my_txt.wordWrap = true;<br />

my_txt.border = true;<br />

my_txt.text = "this is my text"+newline;<br />

my_txt.text += "this is more text"+newline;<br />

my_txt.setTextFormat(my_fmt);<br />

color (TextFormat.color property)<br />

public color : Number<br />

A number that indicates the color of text. The number contains three 8-bit RGB components;<br />

for example, 0xFF0000 is red, <strong>and</strong> 0x00FF00 is green.<br />

Note: For Arabic, Hebrew, <strong>and</strong> Thai, this property works for paragraph-level formatting only.<br />

Example<br />

The following example creates a text field <strong>and</strong> sets the text color to red.<br />

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

my_fmt.blockIndent = 20;<br />

my_fmt.color = 0xFF0000; // hex value for red<br />

this.createTextField("my_txt", 1, 100, 100, 300, 100);<br />

my_txt.multiline = true;<br />

my_txt.wordWrap = true;<br />

my_txt.border = true;<br />

my_txt.text = "this is my first text field object text";<br />

my_txt.setTextFormat(my_fmt);<br />

font (TextFormat.font property)<br />

public font : String<br />

A string that specifies the name of the font for text. The default value is null, which indicates<br />

that the property is undefined.<br />

Note: For Flash Lite, this property works for embedded fonts only. This property is not<br />

supported for Arabic, Hebrew, <strong>and</strong> Thai.<br />

TextFormat 659

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

Saved successfully!

Ooh no, something went wrong!