Adobe Flex 4 text height

被刻印的时光 ゝ 提交于 2020-01-07 02:39:08

问题


I remember in Flex 3 text width/height could be calculated (not the text UI component but the 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.


回答1:


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).



来源:https://stackoverflow.com/questions/4375329/adobe-flex-4-text-height

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!