在下面的完整功能的Flex應用程序中的兩個環節之間的換行符應該導入文本輸入到TextFlow中時被保留:Flex TextFlowUtil.importFromString在某些情況下忽略空白。這是一個錯誤?
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
minWidth="955" minHeight="600"
creationComplete="application1_creationCompleteHandler(event)"
>
<fx:Script>
<![CDATA[
import flashx.textLayout.formats.WhiteSpaceCollapse;
import mx.events.FlexEvent;
import spark.utils.TextFlowUtil;
protected function application1_creationCompleteHandler(event : FlexEvent) : void
{
input.text = "<a href='#'>link1</a>\n<a href='#'>link2</a>";
}
protected function button1_clickHandler(event : MouseEvent) : void
{
output.textFlow = TextFlowUtil.importFromString(input.text, WhiteSpaceCollapse.PRESERVE);
}
]]>
</fx:Script>
<s:RichEditableText text=""
id="input"
width="266" height="215"
x="10" y="30"
/>
<s:Label text="Input"
x="10" y="10"
/>
<s:Label text="Output"
x="8" y="286"
/>
<s:Button x="10" y="253"
click="button1_clickHandler(event)"
label="Import"
/>
<s:RichEditableText id="output"
width="399" height="212"
x="10" y="306"
/>
</s:Application>
但是,如果你點擊「導入」,你會看到兩個鏈接創建在同一行(不中斷)。
如果在源文本中的鏈接之間添加任何非空白字符,則此更改。意思是,如果你只是在鏈接之間添加一個「*」,換行符會被保留。
什麼給?這是一個Flex錯誤?
如果您認爲這是一個錯誤,請投票在Adobe的bug系統中:https://bugs.adobe.com/jira/browse/SDK-29566 – 2011-02-17 09:57:56