Why multiple RichEditableText instances cannot share the same TextFlow model ?
I am new to TLF. From what I understand textFlow is simply a data model. It didn't make sense to me that why multiple RichEditableText instances cannot share the same textFlow.
<?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/halo" minWidth="1024" minHeight="768"
creationComplete="onCreationComplete()">
<fx:Script>
<![CDATA[
import spark.primitives.RichEditableText;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.elements.TextFlow;
private var markup:XML = <TextFlow columnCount="inherit" columnGap="inherit" columnWidth="inherit" lineBreak="inherit" paddingBottom="inherit" paddingLeft="inherit" paddingRight="inherit" paddingTop="inherit" paragraphSpaceBefore="20" verticalAlign="inherit" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008"><p><span>Hello</span></p></TextFlow>;
private function onCreationComplete():void
{
var textFlow:TextFlow = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT);
var richEText:RichEditableText = new RichEditableText();
richEText.width = 400;
richEText.height = 500;
richEText.textFlow = textFlow;
addElement(richEText);
var richEText2:RichEditableText = new RichEditableText();
richEText2.width = 300;
richEText2.height = 200;
richEText2.textFlow = textFlow;
addElement(richEText2);
}
]]>
</fx:Script>
</s:Application>
This generates the following run-time error:
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
at flashx.textLayout.elements::TextFlow/http://ns.adobe.com/textLayout/internal/2008::normalize()
at flashx.textLayout.factory::TextFlowTextLineFactory/createTextLines()
at flashx.textLayout.container::TextContainerManager/compose()
at flashx.textLayout.container::TextContainerManager/updateContainer()
at spark.primitives::RichEditableText/updateDisplayList()
at mx.core::UIComponent/validateDisplayList()
at mx.managers::LayoutManager/validateDisplayList()
at mx.managers::LayoutManager/doPhasedInstantiation()
at mx.managers::LayoutManager/doPhasedInstantiationCallback()
I am using SDK 9091. Any help is appreciated.
The way to get around this so far is to make a deepcopy of your textFlow for every richEditableText instance you need.
Thanks,
Heather
