如何让 Flex 文本控件自动换行 [英] how to get a Flex text control to word wrap

查看:55
本文介绍了如何让 Flex 文本控件自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个 Adob​​e Flex 应用程序,我有一个 Text 控件 (mx:Text),据说当您需要多行不可编辑文本(而不是标签,它是单行不可编辑文本)时使用.当我将浏览器窗口的大小调整为小于文本(或在浏览器窗口已经较小的情况下加载它)时,我的文本控件不会换行.在咨询了我发现的 this doc 后,它似乎只有在以像素为单位指定绝对宽度时才会出现自动换行功能.这正是我想要避免的.我希望文本环绕以适应给定给我的 Flash 对象的大小,以便它始终可见......有没有办法通过我丢失的某些属性或不同的控件来实现这一点?谢谢.

I'm creating an Adobe Flex application and I have a Text control (mx:Text), which is supposedly used when you need multiline noneditable text (as opposed to a Label, which is single line noneditable text). My text control does not wrap when I resize the browser window to be smaller than the text (or load it with the browser window already smaller). Upon consulting this doc that I found, it would seem that the word-wrap functionality only happens if you specify an absolute width in pixels. That is exactly what I'm trying to avoid. I want the text to wrap to fit inside the size given to my Flash object so that it is always visible... is there any way to accomplish this, through some property I'm missing or perhaps a different control? Thanks.

推荐答案

我遇到了同样的问题.在我的例子中,我有一个 mx:Text 块(应该已包装),并且该 mx:Text 对象嵌入在两个 mx:VBox 容器中.

I had this same problem. In my case I had a mx:Text block (that SHOULD have wrapped), and that mx:Text object was embedded within TWO mx:VBox containers.

让文本成功换行的唯一方法是执行以下两项操作:

The only way that I got the text to wrap successfully was to do BOTH of the following:

  1. 将"width="100%" "属性放入每个 VBox 容器(mx:text 所在的容器).
  2. 将"width="100%" "属性放入每个 mx:Text 对象(位于 VBox 的嵌套中)

非常不直观,但这对我有用.

Very non-intuitive, but this is what worked for me.

希望对你有帮助!

乔恩·金斯廷

这篇关于如何让 Flex 文本控件自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆