Here is a snippet to set a maximum lines to a TextField and truncate the end of the text with a “…” :
function truncate(textfield:TextField, maxLines:int):void
{
// the alternative text
var alt:String = "...";
// if the text displayed has more lines than wished
if (textfield.numLines > maxLines)
{
// index of the last char of the last line to display
var char:int = textfield.getLineOffset(maxLines) - 1;
// remove the length of the alternative text
char -= alt.length;
// get the last non space char index
char = textfield.text.substring(0, char + 1).search(/\S\s*$/);
// set the new text into the textfield
textfield.text = textfield.text.substring(0, char) + alt;
}
}
Using TextFieldAutoSize.LEFT and this code :
truncate(titleTxt, 1); descTxt.y = titleTxt.height; truncate(descTxt, 3);
You get this result :





