开发者

Adobe Flex 4 text height

I remember in Flex 3 text width/height could be calculated (not the text UI component but t开发者_开发问答he text itself):

new Text().textHeight; 

or

new Text().getTextField().measuredHeight;

Does anyone know how can that be done in Flex 4 with its Text Layout Framework now?

Thanks.


I've found an answer myself. If someone has any better ideas - you're welcome.

I use to assume that width of text content is not so important cause each time the size changes the value used below are updated. So I check the height of text (assuming width is fixed) as:

var textHeight: Number = (_text.textLines.length-1) * _text.textFlow.lineHeight + _text.textFlow.fontSize

where _text is s:RichText.

I needed to know whether the text inside did not exceeded the space available, that's why the only thing I need now is to check whether textHeight < _text.height That's it. Be sure the text is rendered correctly before checking the height (I use to listen to UDPATE_COMPLETE event).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜