| Package | flashx.textLayout.formats | 
| Class | public final class TextAlign | 
| Inheritance | TextAlign  Object | 
| Language Version: | ActionScript 3.0 | 
| Runtime Versions: | Flash Player 10, AIR 1.5 | 
textAlign and textAlignLast properties
	  of the TextLayoutFormat class. The values describe the alignment of lines in the paragraph relative to the 
	  container.
	 
	 Related API Elements
Public Properties
| Property | Defined By | ||
|---|---|---|---|
|  | constructor : Object 
	 A reference to the class object or constructor function for a given object instance. | Object | |
Public Methods 
| Method | Defined By | ||
|---|---|---|---|
|  | 
	 Indicates whether an object has a specified property defined. | Object | |
|  | 
	 Indicates whether an instance of the Object class is in the prototype chain of the object specified 
	 as the parameter. | Object | |
|  | 
	 Indicates whether the specified property exists and is enumerable. | Object | |
|  | 
     Sets the availability of a dynamic property for loop operations. | Object | |
|  | 
	 Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
|  | 
	 Returns the string representation of the specified object. | Object | |
|  | 
	 Returns the primitive value of the specified object. | Object | |
Public Constants
| Constant | Defined By | ||
|---|---|---|---|
| CENTER : String = "center" [static]  Specifies center alignment within the container. | TextAlign | ||
| END : String = "end" [static]  Specifies end edge alignment - text is aligned opposite from the writing order. | TextAlign | ||
| JUSTIFY : String = "justify" [static]  Specifies that text is justified within the lines so they fill the container space. | TextAlign | ||
| LEFT : String = "left" [static]  Specifies left edge alignment. | TextAlign | ||
| RIGHT : String = "right" [static]  Specifies right edge alignment. | TextAlign | ||
| START : String = "start" [static]  Specifies start edge alignment - text is aligned to match the writing order. | TextAlign | ||
Constant Detail
| CENTER | Constant | 
public static const CENTER:String = "center"| Language Version: | ActionScript 3.0 | 
| Runtime Versions: | Flash Player 10, AIR 1.5 | 
Specifies center alignment within the container.
| END | Constant | 
public static const END:String = "end"| Language Version: | ActionScript 3.0 | 
| Runtime Versions: | Flash Player 10, AIR 1.5 | 
Specifies end edge alignment - text is aligned opposite from the writing order. Equivalent to specifying right in left-to-right text, or left in right-to-left text.
| JUSTIFY | Constant | 
public static const JUSTIFY:String = "justify"| Language Version: | ActionScript 3.0 | 
| Runtime Versions: | Flash Player 10, AIR 1.5 | 
Specifies that text is justified within the lines so they fill the container space.
| LEFT | Constant | 
public static const LEFT:String = "left"| Language Version: | ActionScript 3.0 | 
| Runtime Versions: | Flash Player 10, AIR 1.5 | 
Specifies left edge alignment.
| RIGHT | Constant | 
public static const RIGHT:String = "right"| Language Version: | ActionScript 3.0 | 
| Runtime Versions: | Flash Player 10, AIR 1.5 | 
Specifies right edge alignment.
| START | Constant | 
public static const START:String = "start"| Language Version: | ActionScript 3.0 | 
| Runtime Versions: | Flash Player 10, AIR 1.5 | 
Specifies start edge alignment - text is aligned to match the writing order. Equivalent to setting left in left-to-right text, or right in right-to-left text.
Examples How to use this example 
TextAlignExample.as
 This example aligns three paragraphs of "Hello World" using
   CENTER, JUSTIFY, and RIGHT alignment.
package flashx.textLayout.formats.examples {
    import flash.display.Sprite;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.formats.TextAlign;
    import flashx.textLayout.formats.TextJustify;
    public class TextAlignExample extends Sprite
    {
        public function TextAlignExample()
        {
            var textFlow:TextFlow = new TextFlow();
            //create paragraphs and corresponding spans
            var pCenter:ParagraphElement = new ParagraphElement();
            var pJustify:ParagraphElement = new ParagraphElement();
            var pRight:ParagraphElement = new ParagraphElement();    
            var spanCenter:SpanElement = new SpanElement();
            var spanJustify:SpanElement = new SpanElement();
            var spanRight:SpanElement = new SpanElement();
            // add text to the spans
            spanCenter.text = "Hello, World\n";
            spanJustify.text = "Hello, World\n";
            spanRight.text = "Hello, World";
            // add spans to paragraphs and specify alignment
            pCenter.addChild(spanCenter);
            pCenter.textAlign = TextAlign.CENTER;
            
            pJustify.addChild(spanJustify);
            pJustify.textAlign = TextAlign.JUSTIFY;
            pJustify.textJustify = TextJustify.DISTRIBUTE;
                    
            pRight.addChild(spanRight);
            pRight.textAlign = TextAlign.RIGHT;
            // add paragraphs to TextFlow
            textFlow.addChild(pCenter);
            textFlow.addChild(pJustify);
            textFlow.addChild(pRight);
            // update controller to display
            textFlow.flowComposer.addController(new ContainerController(this,80,800));
            textFlow.flowComposer.updateAllControllers();
        }
    }
}
Thu Dec 4 2014, 05:50 PM -08:00