# TextFieldAutoSize.RIGHT;

**URL:** https://forum.kirupa.com/t/textfieldautosize-right/294802
**Category:** flash
**Created:** [August 20, 2009, 2:43am UTC](https://forum.kirupa.com/t/textfieldautosize-right/294802 "2009-08-20T02:43:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![vxd](https://avatars.discourse-cdn.com/v4/letter/v/848f3c/32.png) [@vxd](https://forum.kirupa.com/u/vxd)
#### Post date: [August 20, 2009, 2:43am UTC](https://forum.kirupa.com/t/textfieldautosize-right/294802/1 "2009-08-20T02:43:40Z")

</div>

I’m looking for an explanation on why when I use TextFieldAutoSize.RIGHT;

x != 0

Here my code

```auto

package {
    import flash.events.*;
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormatAlign;

    public class Sample extends Sprite {

        //Create an instance for the name textfield
        private var tName:TextField;
        //create a new textformat for tName
        private var tfName:TextFormat =new TextFormat();
        //Array that stores the words
       priavte var aNames:Array = new Array("Word","Another Word", "Some more Words", "Hello", "Telephone", "perpendicular", "hippopotamus")

        public function Sample():void {
      addText()

        }//Sample()
        private function addText():void {

            // **********Text Format********** \\
            //Set text colour
            tfName.color = 0x000000;
            //Set text font
            tfName.font = "Calibri";
            //Set text size
            tfName.size = 14//;
            //align text to the right
            //tfName.align = TextFormatAlign.RIGHT;
            // *******End TextFormat********** \\

            //loop through the array to retrieve the names
            for (var i:int = 0; i< aNames.length; i++) {

                //create a new textfield for the name
                tName = new TextField();
                //Add the text in the textfield
                tName.text = aNames*
                //set text format
                tName.setTextFormat(tfName);
                //x and y of tName
                tName.y = i* 20;
           
      
                //tName width
   
                tName.autoSize = TextFieldAutoSize.RIGHT;
                tName.multiline = false;
                tName.selectable = false;

                trace(tName.width + " " + tName.x)
                //Create a new input field
            
                
              
 addChild(tName);
               
                
            }//End loop

            
        }//addtext()
    }//Class
}//Package

```
