Apache flex 如何允许Spark文本区域中的选项卡?
我想在Spark TextArea中键入选项卡,我找到的唯一示例是mx TextArea 下面是我从建议使用Apache flex 如何允许Spark文本区域中的选项卡?,apache-flex,flex4,tlf,Apache Flex,Flex4,Tlf,我想在Spark TextArea中键入选项卡,我找到的唯一示例是mx TextArea 下面是我从建议使用manageTabKey中使用的测试数据: var config:Configuration = new Configuration(); var parser:ITextImporter; config.manageTabKey = true; parser = TextConverter.getImporter(TextConverter.PLAIN_TEXT_FORMAT, con
manageTabKey
中使用的测试数据:
var config:Configuration = new Configuration();
var parser:ITextImporter;
config.manageTabKey = true;
parser = TextConverter.getImporter(TextConverter.PLAIN_TEXT_FORMAT, config);
textarea.textFlow = parser.importToFlow("test data");
MXML:
<s:TextArea id="textarea" width="100%" height="100%">
</s:TextArea>
这将为您获得想要的结果:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600"
creationComplete="creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import flashx.textLayout.elements.Configuration;
protected function creationCompleteHandler(event:FlexEvent):void {
(sparkTextArea.textFlow.configuration as Configuration).manageTabKey = true;
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:TextArea id="sparkTextArea" />
</s:Application>
这在Flex4.6.0中起作用,我尝试了以下方法,但没有效果:`var-config:Configuration=new-Configuration();var解析器:ITextImporter;config.manageTabKey=true;parser=TextConverter.getImporter(TextConverter.PLAIN\u TEXT\u格式,配置);textarea.textFlow=parser.importToFlow(“测试”)`您使用的是什么flex版本?我已经在4.6.0中对它进行了测试,它的效果非常好。我会再试一次。我确信它抛出了一个只读的编译器错误。哦,我想可能是因为我把它演成了IConfiguration???真管用!谢谢仅供参考,我正在将其转换为
IConfiguration(sparkTextArea.textFlow.configuration作为配置)代码>这给了我编译器错误类型1059:属性是只读的。
。现在可以了。