Flash / Flex / ActionScript/TextField/autosize — различия между версиями

Материал из Web эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 09:19, 26 мая 2010

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);
    }
  }
}



TextFieldAutoSize.CENTER

 
package {
  import flash.display.Sprite;
  import flash.text.TextField;
  public class Main extends Sprite {
    public function Main(  ) {
      var field:TextField = new TextField(  );
     
      field.autoSize = flash.text.TextFieldAutoSize.CENTER;
      field.text = "text text text text text text text text text text text text text text text text text text text text text text text text text ";
      addChild(field);
    }
  }
}



TextFieldAutoSize.LEFT

 
package {
  import flash.display.Sprite;
  import flash.text.TextField;
  public class Main extends Sprite {
    public function Main(  ) {
      var field:TextField = new TextField(  );
      field.autoSize = flash.text.TextFieldAutoSize.LEFT;
      field.text = "text text text text text text text text text text text text text text text text text text text text text text text text text ";
      addChild(field);
    }
  }
}



TextFieldAutoSize.RIGHT

 
package {
  import flash.display.Sprite;
  import flash.text.TextField;
  public class Main extends Sprite {
    public function Main(  ) {
      var field:TextField = new TextField(  );
   
      field.autoSize = flash.text.TextFieldAutoSize.RIGHT;
      field.text = "text text text text text text text text text text text text text text text text text text text text text text text text text ";
      addChild(field);
    }
  }
}