我的应用程序中有一个面板,用户可以更改其宽度。我的问题是标题很长。我想通过改变宽度裁剪标题。 我试过changind titleTextField的宽度: this.titleTextField.width = ...; 但它不起作用。 任何人都可以帮助我吗?
答案 0 :(得分:1)
刚剪裁文字: 使用此功能
private function cropText(str:String,w:int=-1):String{
return (w != -1)?str.substr(0,w)+"...":str;
}
如何使用:
title = cropText(“HELLOW WORLD”,10);
输出:
HELLOW WOR...
希望它能解决你的问题