Label word wrap in Flex 4

江枫思渺然 提交于 2019-12-04 17:36:22

You can use maxDisplayedLines and lineBreak properties with spark Label component:

<s:Label  maxDisplayedLines="{-1}"  lineBreak="toFit"   text="...." />

It works with Flex 4.5.

Try <s:SimpleText />. From the excellent Migration Guide (p. 75):

The lightest-weight component of the text primitives. The SimpleText class supports the least number of text features. This class is similar to the Label class, except that it supports multiple lines. It does not support user ineractivity such as selection, editing, or scrolling.

Hope that helps!

Spark Label can display multiple lines, which MX Label cannot:

In Spark Label, three character sequences are recognized as explicit line breaks: CR ("\r"), LF ("\n"), and CR+LF ("\r\n").

If you don't specify any kind of width for a Label, then the longest line, as determined by these explicit line breaks, determines the width of the Label.

If you do specify some kind of width, then the specified text is word-wrapped at the right edge of the component's bounds, because the default value of the lineBreak style is "toFit". If the text extends below the bottom of the component, it is clipped.

To disable this automatic wrapping, set the lineBreak style to "explicit". Then lines are broken only where the text contains an explicit line break, and the ends of lines extending past the right edge is clipped.

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