I’m looking for an explanation on why when I use TextFieldAutoSize.RIGHT;
x != 0
Here my code
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