[swf width="550" height="300" background="#FFFFFF"]http://www.zh-webdesign.ch/zoa/autosize_text3.swf[/swf].

Just an exammple of the textFormat object.

Code:
// Creating textfield text format
fieldTextFormat = new TextFormat();
fieldTextFormat.font = "Arial";
fieldTextFormat.bold = false;
fieldTextFormat.italic = false;
fieldTextFormat.align = "left";		
	
// Creating the base textfield
createTextField("mytext", 1, 200, 100, 200, 150);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = true;
mytext.html = false;
mytext.type = "input";
mytext.selectable = true;	
mytext.text = thetext;
mytext.autosize = "left";
mytext.borderColor = 0xaaaaaa;
mytext.text = "Test the format object!";
mytext.setTextFormat(fieldTextFormat);

// Set labelös of the button components
bold_button.setLabel("bold");
italic_button.setLabel("italic");
left_button.setLabel("LEFT");
center_button.setLabel("center");
right_button.setLabel("right");

// Set font provider
myfonts=TextField.getFontList();
fontList.setDataProvider(myfonts);
fontList.setSize(300);
fontList.setSelectedIndex(20);

// set font-size provider
fontSizes =  new Array(6,8,10,12,14,16,18,20,24,28,32,40,48,56,64);
fontSize.setDataProvider(fontSizes);
fontList.setSelectedIndex(4);

// change font when new one selected
fontList.setChangeHandler("myHandler");
function myHandler(component){
   fieldTextFormat.font = fontList.getSelectedItem().label; 
   mytext.setTextFormat(fieldTextFormat);
}

// change font-size when new one selected
fontSize.setChangeHandler("myHandler2");
function myHandler2(component){
   fieldTextFormat.size = fontSize.getSelectedItem().label; 
   mytext.setTextFormat(fieldTextFormat);
}

// Functions for the buttons
function makeBold(){
	if (fieldTextFormat.bold){
		fieldTextFormat.bold = false;
		bold_button.setLabel("bold");
	} else {
		fieldTextFormat.bold = true;
		bold_button.setLabel("BOLD");
	}
	mytext.setTextFormat(fieldTextFormat);
}
function makeItalic(){
	if (fieldTextFormat.italic){
		fieldTextFormat.italic = false;
		italic_button.setLabel("italic");
	} else {
		fieldTextFormat.italic = true;
		italic_button.setLabel("ITALIC");
	}
	mytext.setTextFormat(fieldTextFormat);
}
function makeLeft(){
	fieldTextFormat.align = "left";
	left_button.setLabel("LEFT");
	center_button.setLabel("center");
	right_button.setLabel("right");
	mytext.setTextFormat(fieldTextFormat);
}
function makeCenter(){
	fieldTextFormat.align = "center";
	left_button.setLabel("left");
	center_button.setLabel("CENTER");
	right_button.setLabel("right");
	mytext.setTextFormat(fieldTextFormat);
}
function makeRight(){
	fieldTextFormat.align = "right";
	left_button.setLabel("left");
	center_button.setLabel("center");
	right_button.setLabel("RIGHT");
	mytext.setTextFormat(fieldTextFormat);
}
Fredi