Sizing Text Fields to Fit Contents : autosize « TextField « Flash / Flex / ActionScript






Sizing Text Fields to Fit Contents

 

package {

  import flash.display.Sprite;
  import flash.text.TextField;
  public class Main extends Sprite {
    public function Main(  ) {
      var field:TextField = new TextField(  );
      // These two lines do the same thing
      field.autoSize = flash.text.TextFieldAutoSize.LEFT;
    //  field.autoSize = true;
      field.htmlText = "hello            friend";
      addChild(field);
    }
  }
}

        








Related examples in the same category

1.TextFieldAutoSize.CENTER
2.TextFieldAutoSize.RIGHT
3.TextFieldAutoSize.LEFT