Expanding a textfield within boundaries

hi everyone, this is something i can’t quite get my head around. i’m sure there is a simple answer out there.

basically the user types his or her text into the text input field called inputText. this is the shown as a new text field called printfield within a boundary called border. now as the user types in the text printfield expands to the size of boundary(border) then stops. now what i would like it to do is expand the size of the boundary then delete the last letter in the input field (inputText) that printfield stays always within the boundary.

many thanks in adavnce for some help.

// Initialize variables
var fontSize:int = 20;
var inputName:String = "text here!!";

// set the text format in the textfield
var myFormat:TextFormat = new TextFormat();
myFormat.size = fontSize;

// call in the textfield
var printfield:TextField = new TextField();
printfield.defaultTextFormat = myFormat;
printfield.text = inputName;
printfield.x = border.x;
printfield.y = border.y;
printfield.selectable = false;
printfield.autoSize = TextFieldAutoSize.LEFT;
printfield.border = true;
printfield.borderColor = 0x000000;
addChild(printfield);

// the input textfield listner
inputText.text = inputName;
inputText.addEventListener(KeyboardEvent.KEY_UP, ChangeText);

// function to change the text in the textfield
function ChangeText(event:KeyboardEvent):void {
    var newtext:String = inputText.text;
    if (printfield.width < border.width) {
    printfield.text = newtext;
    }
    if (printfield.width > border.width) {
    // here is where i would like to delete the last letter
    // in the input field that printfield stays within the border
    inputText.maxChars = (inputText.length - 1);
    trace("too wide");
    }
}