【问题标题】:how to use '\n' within text property of mx:TextArea in flex 4?如何在 flex 4 的 mx:TextArea 的文本属性中使用 '\n'?
【发布时间】:2011-10-29 13:22:02
【问题描述】:

根据我的观察,这在 flex4 中不起作用:

<mx:TextArea id="taMytext" text="\n hi\n san"/> //use of \n does not work here
<s:Button label="Click it" click="Myfun()" />

使用脚本是可能的:

public function Myfun():void
            {
                taMytext.text="hi\n";
                taMytext.text+="san";
            }

【问题讨论】:

    标签: apache-flex flex3 textarea


    【解决方案1】:

    似乎唯一的方法是使用以下内容:

    <mx:TextArea horizontalCenter="0" id="taMytext" text="{'\n'} hi{'\n'} san" verticalCenter="0" />
    

    【讨论】:

    • 感谢您的回答.. :)
    【解决方案2】:

    您必须使用以下语法:

    <mx:TextArea id="taMytext" text="\n hi{'\n'} san"/>
    

    更详细的解释可以找到on adobe cookbooks

    【讨论】:

    • 是什么意思哪个可以代替 {'\n'} ?
    • 这是在规范 XML 中表示回车符 ('\r') 的方式。 More details
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-05
    • 1970-01-01
    • 2011-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多