Study/Actionscript 3.02010. 7. 4. 21:46

http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002262.html


align (TextFormat.align property)

public align : String

A string that indicates the alignment of the paragraph. You can apply this property to static and dynamic text. The following list shows possible values for this property:

  • "left"--The paragraph is left-aligned.
  • "center"--The paragraph is centered.
  • "right"--The paragraph is right-aligned.
  • "justify"--The paragraph is justified. (This value was added in Flash Player 8.)

The default value is null, which indicates that the property is undefined.

Availability: ActionScript 1.0; Flash Player 6 - The "justify" value is available beginning with Flash Player 8.

Example

The following example shows the align property being set to justify, which causes the characters on each line to be spread out so that the text looks more evenly spaced horizontally.

var format:TextFormat = new TextFormat();
format.align = "justify";

var txtField:TextField = this.createTextField("txtField", this.getNextHighestDepth(), 100, 100, 300, 100);
txtField.multiline = true;
txtField.wordWrap = true;
txtField.border = true;
txtField.text = "When this text is justified, it will be "
    + "spread out to more cleanly fill the horizontal "
    + "space for each line. This can be considered an "
    + "improvement over regular left-aligned text that "
    + "will simply wrap and do no more.";
txtField.setTextFormat(format);

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components' DepthManager class instead of the MovieClip.getNextHighestDepth() method.

Posted by chacolina