如何获得一个Flex文本控件来自动换行 [英] how to get a Flex text control to word wrap

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

问题描述

我创建了一个Adobe Flex应用程序,并且我有一个Text控件(mx:Text),当您需要多行不可编辑文本时(与单行不可编辑标签相对),该控件应该可以使用。当我将浏览器窗口调整为小于文本的大小时(或者浏览器窗口已经小了),我的文本控件不会打包。在查阅我发现的此文档后,似乎只有在指定像素的绝对宽度时才会出现单词封装功能。那正是我想要避免的。我想要的文本来适应内部给我的Flash对象的大小,以便它始终可见...有什么办法来完成这一点,通过一些属性,我失踪或可能是一个不同的控制?谢谢。

解决方案

我有同样的问题。在我的情况下,我有一个mx:文本块(应该包装),而且mx:Text对象被嵌入在TWO mx:VBox容器中。



成功包装文本的唯一方法是做以下两项:


  1. 将'width =100%'属性放入每个VBox容器(其中mx:文本所在的位置)。
  2. 将width =100% '属性到每个mx:Text对象(驻留在VBox的嵌套中)

非常不直观,但是这是行得通的为了我。



我希望这可以帮助你!

Jon Kinsting


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.

解决方案

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. put the ' width="100%" ' property into EACH VBox container (in which the mx:text resided).
  2. put the ' width="100%" ' property into EACH mx:Text object (residing within this nesting of VBox's)

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

I hope this helps you!

Jon Kinsting

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

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