Skip to main content
Participating Frequently
January 20, 2011
Answered

Interesting Multiple Container Bug in TLF

  • January 20, 2011
  • 1 reply
  • 628 views

Hi All,

I've hit a bit of a roadbump in developing an AIR app (2.5.1.17730 runtime) using the TLF and wonder if anyone else has seen it and come up with a workaround. Consider the mxmxl below. When you run the app, you two columns of text as you would expect. Editing (cut, paste, type, undo, redo) all work fine anywhere except when you edit the second line of the second column. Then the whole second column is pushed down to the y-value of the first column until you do an edit somehwere else in the window (say, put a space in the first column somewhere). I have pored over this for quite a while and have come to the considered opinion that (a) it's a bug, and (b) I haven't a clue what is causing it or how to work around it.

Any suggestions?

Thanks!

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        creationComplete="init(event)" viewSourceURL="srcview/index.html">
<fx:Script>
  <![CDATA[
   import flashx.textLayout.container.ContainerController;
   import flashx.textLayout.conversion.ITextImporter;
   import flashx.textLayout.conversion.TextConverter;
   import flashx.textLayout.edit.EditManager;
   import flashx.textLayout.elements.TextFlow;
   import flashx.undo.UndoManager;
  
   import mx.events.FlexEvent;

   private var _textContainer:SpriteVisualElement = null;
  
   private static const textInput:XML = <TextFlow xmlns="http://ns.adobe.com/textLayout/2008">
    <div>
     <p><span>Qui magna velit consequat, lobortis iriure autem augue duis exerci blandit esse laoreet ex eros, adipiscing aliquip, ut, vel eum. Vero consectetuer dolor feugait dolore lobortis delenit nibh eu, te et in, dolore. Nulla ut enim consequat diam adipiscing nulla facilisis zzril te laoreet at. Iusto quis esse nulla et, aliquam quis, facilisi euismod, diam eros ut dolore commodo erat et ad tation, illum. Autem, qui wisi odio ad vel esse ad ad. Velit vel facilisis iriure, et nisl aliquip iriure zzril.
       Praesent tincidunt blandit nulla, odio, sed vulputate ipsum dolore duis in veniam iriure zzril minim odio suscipit dignissim wisi. Feugiat, volutpat duis vero ut elit zzril, te commodo duis. Molestie ea erat et volutpat dolore vel molestie consequat tincidunt hendrerit consequat. Euismod, consequat blandit nostrud facilisi qui delenit duis, molestie tation illum accumsan amet dolor feugait molestie ea consectetuer wisi. Adipiscing lobortis, ut veniam nostrud accumsan vero elit dolore ex nulla ullamcorper sit qui. Qui magna velit consequat, lobortis iriure autem augue duis exerci blandit esse laoreet ex eros, adipiscing aliquip, ut, vel eum.
       Vero consectetuer dolor feugait dolore lobortis delenit nibh eu, te et in, dolore. Nulla ut enim consequat diam adipiscing nulla facilisis zzril te laoreet at.</span></p>
    </div>
    </TextFlow>;
  
   private var _textFlow:TextFlow;
  
   private function init(evt:Event):void {
   
    var importer:ITextImporter = TextConverter.getImporter(TextConverter.TEXT_LAYOUT_FORMAT);
    importer.throwOnError = true; // will throw exception if parsing error occurs on import
   
    _textFlow = importer.importToFlow(textInput);
    _textFlow.flowComposer.addController(new ContainerController(col1, col1.width, col1.height));
    _textFlow.flowComposer.addController(new ContainerController(col2,col2.width,col2.height));
   
    col2.x = g1.width*0.55;
   
    //adding Select/Edit/Copy/Paste/Undo features
    _textFlow.interactionManager = new EditManager(new UndoManager());
   
    // initialize with a selection before the first character
    _textFlow.interactionManager.selectRange(0,0);
    _textFlow.flowComposer.updateAllControllers();
   }

  ]]>
</fx:Script>
<fx:Declarations>
  <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<s:Group x="0" y="0" width="100%" height="100%" id="g1">
  <s:SpriteVisualElement x="0" y="0" height="100%" width="45%" id="col1"/>
  <s:SpriteVisualElement y="0" height="100%" width="45%" id="col2"/>
</s:Group>
</s:WindowedApplication>

This topic has been closed for replies.
Correct answer robin_briggs

This is a bug in the TLF 1.1. It was not there in TLF 1.0, and has been fixed in TLF 2.0 (currently pre-release). You have three options:

- You can go back to TLF 1.0. If you are using Flex 4.1, I think you could do this by putting TLF 1.0 in place of TLF 1.1 in the Flex installation. Alternatively, you could roll back to using Flex 4.0.

- You can go forward to use TLF 2.0. If you are using Flex, this would mean adopting the pre-release Hero version of Flex.

- You can create your own TLF 1.1 with a fix. I can provide you with the fix, but you will need to recompile TLF 1.1, which means you cannot use the RSL version of the library.

I apologize for the inconvenience.

- robin

1 reply

robin_briggsCorrect answer
Adobe Employee
January 20, 2011

This is a bug in the TLF 1.1. It was not there in TLF 1.0, and has been fixed in TLF 2.0 (currently pre-release). You have three options:

- You can go back to TLF 1.0. If you are using Flex 4.1, I think you could do this by putting TLF 1.0 in place of TLF 1.1 in the Flex installation. Alternatively, you could roll back to using Flex 4.0.

- You can go forward to use TLF 2.0. If you are using Flex, this would mean adopting the pre-release Hero version of Flex.

- You can create your own TLF 1.1 with a fix. I can provide you with the fix, but you will need to recompile TLF 1.1, which means you cannot use the RSL version of the library.

I apologize for the inconvenience.

- robin

dargreAuthor
Participating Frequently
January 20, 2011

Thanks Robin, that's very helpful. Any idea when 2.0 is slated to go release?