这是我的 MXML
<mx:Text id="name" styleName="textStyle" maxWidth="400"></mx:Text>
然后在同一个文件中我有:
<mx:Script>
<![CDATA[
private function init():void
{
name.text = data.string;
}
]]>
</mx:Script>
data.string
来自数据库,它包含以下内容:
"This is a string \n with two lines."
我也尝试过这个:
"This is a string with two lines."
它们都没有在 Flex 中创建新行,它们都以 \n
和
形式呈现在屏幕上。
如何使用来自数据库的字符串创建新行?
如果我在代码中输入 \n
,它会起作用:
name.text = "test \n test";
但如果我这样做 name.text=data.string;
即使 data.string
具有完全相同的值,它也不会。
最佳答案
我认为您可以在这个网站上找到您想要的东西。
http://www.switchonthecode.com/tutorials/flex-php-tutorial-transmitting-data-using-json
关于php - 如何在 Flex 中对 PHP 字符串使用换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6448510/