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.

}<br />

// Obtain metrics information for the text string<br />

// with the specified formatting.<br />

var metrics:Object = my_fmt.getTextExtent(my_str);<br />

// Create a text field just large enough to display the text.<br />

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

metrics.textFieldWidth,<br />

metrics.textFieldHeight);<br />

my_txt.border = true;<br />

my_txt.wordWrap = true;<br />

// Assign the same text string <strong>and</strong> TextFormat object to the my_txt object.<br />

my_txt.text = my_str;<br />

my_txt.setTextFormat(my_fmt);<br />

The following example creates a multiline, 100-pixel-wide text field that's high enough to<br />

display a string with the specified formatting.<br />

// Create a TextFormat object.<br />

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

// Specify formatting properties for the TextFormat object:<br />

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

my_fmt.bold = true;<br />

my_fmt.leading = 4;<br />

// The string of text to be displayed<br />

var textToDisplay:String = "Macromedia Flash Player 7, now with improved<br />

text metrics.";<br />

// Obtain text measurement information for the string,<br />

// wrapped at 100 pixels.<br />

var metrics:Object = my_fmt.getTextExtent(textToDisplay, 100);<br />

// Create a new TextField object using the metric<br />

// information just obtained.<br />

this.createTextField("my_txt", this.getNextHighestDepth(), 50, 50metrics.ascent,<br />

100,<br />

metrics.textFieldHeight);<br />

my_txt.wordWrap = true;<br />

my_txt.border = true;<br />

// Assign the text <strong>and</strong> the TextFormat object to the TextObject:<br />

my_txt.text = textToDisplay;<br />

my_txt.setTextFormat(my_fmt);<br />

indent (TextFormat.indent property)<br />

public indent : Number<br />

662 ActionScript classes

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

Saved successfully!

Ooh no, something went wrong!