Hi all,
I’m trying to get a textfield going that will tart as a short rectangular textfield allowing user input, but that will resize to however much text they add or remove ( I haven’t figured out how to make it size down as well), and not start off with any extra white space.
I know I should be using trim or some other means of getting rid of white space, but I haven’t figured it out (along with how to automatically size down).
Here is the code for it so far:
class Main extends Sprite
{
public function new ()
{
super ();
createInputTextField();
}
function createInputTextField():Void
{
var tf:TextField = new TextField();
tf.text = "abc";
tf.rtrim;
tf.type = TextFieldType.INPUT;
tf.border = true;
tf.x = (Lib.current.stage.stageWidth - tf.width) / 2;
tf.y = 400;
tf.autoSize = TextFieldAutoSize.CENTER;
addChild( tf );
}
}