Skip to main content
Participant
Aug 6, 2009 1:27 PM UTC
Question

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

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Participating Frequently
Aug 6, 2009 6:39 PM UTC

Ideally a TextFlow should be a pure model, but the design of the Flash Text Engine in the Player (which preceded TLF) makes this difficult or impossible. So TextFlows are unfortunately not sharable.

Gordon Smith

Adobe Flex SDK Team

Translate
HeatherZhAuthor
Participant
Aug 6, 2009 6:46 PM UTC

Thanks Gordon !  Good to know.

Translate