TextFlow.flowComposer.lines

Hi,
I have created a custom highligter class since the EditManager applyFormat is too slow for lots of text and lots of highlights. Everything works great for RichEditableText - The textFlow's flowComposer's lines array contains a listing of TextFlowLines and from there I can determine which ones are visible on the screen or in the viewport, and then from there figure out where the characters (atoms) positioning information is from the TextLine/TextBlock methods.
However, RichEditableText does not support truncation. So I tried RichText, but the textFlow/flowComposer/SpanElement/ParagraphElement are no help. None of the information about the lines is in the rich text with truncation.
What do I do?
I tried going to the source of RichEditableText, but I can't find where the lines of the textFlow get populated in the flowComposer's lines array. The only explination I have for that is that the source in the premium build that I have doesn't match up with the binary - VERY annoying.
Any help?

Look again.  In 1.1 the TextFlowLine is added in FlowComposerBase.as function addLine around line 441.
As discussed earlier directly accessing the textFlow.interactionManager and calling applyFormat in a loop like this will work void the performance issue with applyFormat.  This assumes the text is being edited and there is an interactionManager attached to the TextFlow.
                var rtxt:RichEditableText;
                var em:EditManager = rtxt.textFlow.interactionManager as EditManager;
                em.beginCompositeOperation();
                while (stufftodo)
                    var state:SelectionState = new SelectionState(rtxt.textFlow, startPosition,endPosition);
                    em.applyFormat(newattrs,newCharacterAttributes);
                em.endCompositeOperation();
However we don't support truncation when the text is being edited.  Truncation is only available when the text is being displayed initially and before editing begins.  In that case we're using a faster composer that doesn't maintain an array of TextFlowLines.
Good luck with your custom highlighter class.
Richard

Similar Messages

  • How can i copy line with text and image to ms word

    When I insert an image in textflow using InlineGraphicElement it works, but when I copy the line with the image to MS Word it copies only the text (not the image).
    How can i copy the image to MS Word?

    If you want copy formatted text and image to MS Word, you need to give MS Word rtf markup, because Word can recognize rtf markup but not TLF markup.
    So you need to create a custom clipboard to paste a rtf markup. It's a large feature for you, because you need a tlf-rtf converter in your custom clipboard.
    TLF Custom Clipboard Example:
    package
        import flash.display.Sprite;
        import flash.desktop.ClipboardFormats;
        import flashx.textLayout.container.ContainerController;
        import flashx.textLayout.conversion.ITextImporter;
        import flashx.textLayout.conversion.TextConverter;
        import flashx.textLayout.edit.EditManager;
        import flashx.textLayout.elements.*;
        import flashx.undo.UndoManager;
        // Example code to install a custom clipboard format. This one installs at the front of the list (overriding all later formats)
        // and adds a handler for plain text that strips out all consonants (everything except aeiou).
        public class CustomClipboardFormat extends Sprite
            public function CustomClipboardFormat()
                var textFlow:TextFlow = setup();
                TextConverter.addFormatAt(0, "vowelsOnly_extraList", VowelsOnlyImporter, AdditionalListExporter, "air:text" /* it's a converter for cliboard */);
            private const markup:String = '<TextFlow whiteSpaceCollapse="preserve" version="2.0.0" xmlns="http://ns.adobe.com/textLayout/2008"><p><span color=\"0x00ff00\">Anything you paste will have all consonants removed.</span></p></TextFlow>';
            private function setup():TextFlow
                var importer:ITextImporter = TextConverter.getImporter(TextConverter.TEXT_LAYOUT_FORMAT);
                var textFlow:TextFlow = importer.importToFlow(markup);
                textFlow.flowComposer.addController(new ContainerController(this,500,200));
                textFlow.interactionManager = new EditManager(new UndoManager());
                textFlow.flowComposer.updateAllControllers();
                return textFlow;
    import flashx.textLayout.conversion.ITextExporter;
    import flashx.textLayout.conversion.ConverterBase;
    import flashx.textLayout.conversion.ITextImporter;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.elements.IConfiguration;
    import flashx.textLayout.elements.TextFlow;
    class VowelsOnlyImporter extends ConverterBase implements ITextImporter
        protected var _config:IConfiguration = null;
        /** Constructor */
        public function VowelsOnlyImporter()
            super();
        public function importToFlow(source:Object):TextFlow
            if (source is String)
                var firstChar:String = (source as String).charAt(0);
                firstChar = firstChar.toLowerCase();
                // This filter only applies if the first character is a vowel
                if (firstChar == 'a' || firstChar == 'i' || firstChar == 'e' || firstChar == 'o' || firstChar == 'u')
                    var pattern:RegExp = /([b-df-hj-np-tv-z])*/g;
                    source = source.replace(pattern, "");
                    var importer:ITextImporter = TextConverter.getImporter(TextConverter.PLAIN_TEXT_FORMAT);
                    importer.useClipboardAnnotations = this.useClipboardAnnotations;
                    importer.configuration = _config;
                    return importer.importToFlow(source);
            return null;
        public function get configuration():IConfiguration
            return _config;
        public function set configuration(value:IConfiguration):void
            _config = value;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.ListElement;
    import flashx.textLayout.elements.ListItemElement;
    class AdditionalListExporter extends ConverterBase implements ITextExporter
        /** Constructor */
        public function AdditionalListExporter()   
            super();
        public function export(source:TextFlow, conversionType:String):Object
            if (source is TextFlow)
                source.getChildAt(source.numChildren - 1).setStyle(MERGE_TO_NEXT_ON_PASTE, false);
                var list:ListElement = new ListElement();
                var item1:ListItemElement = new ListItemElement();
                var item2:ListItemElement = new ListItemElement();
                var para1:ParagraphElement = new ParagraphElement();
                var para2:ParagraphElement = new ParagraphElement();
                var span1:SpanElement = new SpanElement();
                span1.text = "ab";
                var span2:SpanElement = new SpanElement();
                span2.text = "cd";
                list.addChild(item1);
                list.addChild(item2);
                item1.addChild(para1);
                para1.addChild(span1);
                item2.addChild(para2);
                para2.addChild(span2);
                source.addChild(list);
                var exporter:ITextExporter = TextConverter.getExporter(TextConverter.TEXT_LAYOUT_FORMAT);
                exporter.useClipboardAnnotations = this.useClipboardAnnotations;
                return exporter.export(source, conversionType);   
            return null;

  • Adding space at the end of a ritchEditableText  line

    Hi!
    I found an interesting behaviour in my application.  I have a RichEditableText component with a fixed width . If I add text till almost the end of the line and then  insert spaces, the cursor get's stuck at the end of the line. My surprise was on retreiving the text from that line in the code, where all that spaces existed even if they were not visible in the app. So on screen you see let's say 3 spaces, but then you save the text you can get 10. If you keep inserting any letter the cursor will move itself to the next line, but this does not seem to be the case of " "(space).
    I tested it useing the following code. I'm useing 4.1 sdk.
    <s:RichEditableText id="richTxt"  width="100" height="500" change="richTxt_changeHandler(event)" />
    protected function richTxt_changeHandler(event:TextOperationEvent):void
                    var noOfLines:int = richTxt.textFlow.flowComposer.numLines;             
                    for (var i:int = 0; i < noOfLines; i++)
                        var startIndex:int = richTxt.textFlow.flowComposer.getLineAt(i).absoluteStart;
                        var seqLength:int = richTxt.textFlow.flowComposer.getLineAt(i).textLength-1;
                        var textLine:String = richTxt.text.substr(startIndex, seqLength);
    I try to set clipAndEnableScrolling=true; for richTxt but this thid not change anything.
    How can I retrieve only the visible text( with the corect number of spaces at the end of the line) from the RET in order to save it ?
    Thanks !

    Do you want to handle that space or just use the text value?
    If you just want to use the text value (i.e 1word - space)...u simply say CONDENSE <UR TEXT VARIABLE>.
    Else the other option is: Find the string length and then handle it the way u want.
    Or if u r sure that every word has that extra space, and u dont want that u can even use SHIFT RIGHT BY 1 PLACE in thet text variable.
    Hope this helps.
    Thanks
    Kiran

  • TextFlow.verticalAlign

    When Setting Vertical Align on a TextFlow to VerticalAlign.MIDDLE or VerticalAlign.BOTTOM, The First TextFlowLine Selection and Caret is vertically offset with respect to the distance of vertical space between the top of the Container boundary and the top of the First Line of Text.
    What is the trick to make the Text Selection line up on the First TextFlowLine when verticalAlign is not set to 'top'?
    below is a simple code example that demonstrates it. The first line of text "Hello World" is positioned properly, however when you click on
    the TextLine to edit it, the Caret appears some 100 pixels below where its supposed to, and so does the text selection.
    I am loading this module within an app that is compiled in SDK 3.2
    /******************************      BEGIN CODE ******************************/
    package {
        import flash.text.engine.BreakOpportunity;
        import flashx.textLayout.container.ContainerController;
        import flashx.textLayout.edit.EditManager;
        import flashx.textLayout.elements.Configuration;
        import flashx.textLayout.elements.ParagraphElement;
        import flashx.textLayout.elements.SpanElement;
        import flashx.textLayout.elements.TextFlow;
        import flashx.textLayout.formats.TextLayoutFormat;
        import flashx.textLayout.formats.VerticalAlign;
        import mx.core.UIComponent;
        public class TextFrameExample extends UIComponent
            var textFlow:TextFlow;
            public function TextFrameExample()
                var config:Configuration = new Configuration();
                var textLayoutFormat:TextLayoutFormat = new TextLayoutFormat();
                textLayoutFormat.color = 0xFF0000;
                textLayoutFormat.fontFamily = "_sans";
                textLayoutFormat.fontSize = 22;
                textLayoutFormat.breakOpportunity = BreakOpportunity.ANY;
                textLayoutFormat.verticalAlign = VerticalAlign.MIDDLE;
                config.textFlowInitialFormat = textLayoutFormat;
                textFlow = new TextFlow(config);
                var globalP:ParagraphElement = new ParagraphElement();
                var p:ParagraphElement = new ParagraphElement();
                var span:SpanElement = new SpanElement();
                span.text = "Hello, World!";
                p.verticalAlign = VerticalAlign.TOP;
                p.addChild(span);
                textFlow.addChild(p);           
                p = new ParagraphElement();
                span = new SpanElement();
                  p.verticalAlign = VerticalAlign.TOP;
                span.text = "Next Line should be split into some columns after all this right? i mean come on";
                p.addChild(span);
                textFlow.addChild(p);
                p = new ParagraphElement();
                span = new SpanElement();
                span.verticalAlign = VerticalAlign.TOP;
                span.text = "Next Line should be split into some columns after all this right? i mean come on";          
                p.addChild(span);
                textFlow.addChild(p);
                textFlow.interactionManager = new EditManager();
                textFlow.flowComposer.addController(new ContainerController(this, 0, 0));
                textFlow.flowComposer.getControllerAt(0).setCompositionSize(500, 500);
                textFlow.flowComposer.updateAllControllers();
            override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                super.updateDisplayList(unscaledWidth, unscaledHeight);
                textFlow.flowComposer.getControllerAt(0).setCompositionSize(unscaledWidth, unscaledHeight);
                textFlow.flowComposer.updateAllControllers();
    /******************************      BEGIN CODE ******************************/
    Thanks for your time!
    Bow

    The verticalAlign property in TLF works only at the TextFlow or container level. So you can set the verticalAlign for an entire component, but not for individual paragraphs or spans. That's something it would be nice to add in the future, but not supported now. Sorry.
    - robin

  • Accessing the 'text' in a TextFlow instance?

    How do I actually access the textual content of a TextFlow object?
    When there is a single SpanElement in the TextFlow then I am able to use ...
    mySpan.text
    But if I have added multiple SpanElements to the ParagraphElement then how do I get the entire textual content so that I can store it in a String variable.
    I am also having problems accessing the entire text when the user has pasted in to an editable field, I presume this is because of multiple SpanElements being created.
    Is there anything that is the equivalent to the old ...
    myTextField.text
    Thanks in advance,
    Adrian

    Hi Alan,
    Thank you so much for your help!!!
    Just for the record, here is a working example ...
    import flashx.textLayout.container.*;
    import flashx.textLayout.elements.*;
    import flashx.textLayout.edit.*;
    var config:Configuration = new Configuration();
    config.manageEnterKey = false;
    var textFlow:TextFlow = new TextFlow(config);
    var para:ParagraphElement = new ParagraphElement();
    var span1:SpanElement = new SpanElement();
    span1.text = "Hello ";
    span1.fontSize = 12;
    var span2:SpanElement = new SpanElement();
    span2.text = "World";
    span2.fontSize = 16;
    para.addChild(span1);
    para.addChild(span2);
    textFlow.addChild(para);
    var cc:ContainerController = new ContainerController(this, 550, 400);
    textFlow.flowComposer.addController(cc);
    textFlow.flowComposer.updateAllControllers();
    trace("textFlow.numChildren:"+textFlow.numChildren);
    // OUTPUT: 1
    trace("para.numChildren:"+para.numChildren);
    // OUTPUT: 2
    trace("textFlow.getText():"+textFlow.getText());
    // OUTPUT: Hello World

  • Re: How to set the line height of a Label?

    In Java 8, set the graphic of the label to a TextFlow with line spacing set.
    Text text = new Text("This is my\nspaced text.");
    TextFlow flow = new TextFlow(text);
    flow.setLineSpacing(13); // default font size is 13px, so this effectively makes the text double spaced, e.g. one line of text, one blank line, another line of text, another blank line, etc.
    Label label = new Label();
    label.setGraphic(flow);
    For Java 7, I don't know how you would set line spacing for a label.

    In Java 8 you can do it even more simply:
    Label label = new Label("This is my\nspaced text");
    label.setLineSpacing(13);
    The line spacing property can also be set with css:
    .label {
    -fx-line-spacing: 13;
    Of course, none of that actually helps to do this in Java 7. If you're not wrapping the text, you can fairly easily split the text at new lines, and add a label for each line to a VBox, specifying the spacing for the VBox as required.
    If you're wrapping text, trying something similar gets ugly rather quickly.

  • TextFlow into multiple RichEditableText containers keeping container styles

    I'm stumped.
    Can  anyone help me to flow text into multiple RichEditableText contianers  with different styles applied to each container?  When I use the  following code, it works for flowing text between the containers but it  does not adopt the styles of the RichEditableText objects that I attach.
    var textFlow:TextFlow;
    textFlow  = TextConverter.importToFlow("one two three four five six seven eight  nine ten eleven twelve thirteen", TextConverter.PLAIN_TEXT_FORMAT);
    textFlow.flowComposer.addController(new ContainerController(richTextEditor1, richTextEditor1.width, richTextEditor1.height));
    textFlow.flowComposer.addController(new ContainerController(richTextEditor2, richTextEditor2.width, richTextEditor2.height));
    textFlow.flowComposer.updateAllControllers();
    I  have tried to apply styles directly to the ContainerControllers with no  success.  I can apply a style to the TextFlow but it uses that style  for the all containers where the text is flowing into.
    If I  attach the textFlow object directly to the textFlow property in the  RichEditableText object, it will keep the formatting of the  RichEditableText.  But then I can't figure out how to make it flow to  the next text box.
    I even tried adding the additional  controller (attached to the second RichEditableText) to the TextFlow  after attaching it to the first RichEditableText object.  No luck.
    I hope this is a stupid qustion and there is a simple answer.  Any help is appreciated.
    Thank you!
    Mike

    Unfortunately it is a good question and there isn't a simple answer.
    The RichEditableText component was not built with multiple containers in mind, so you'll run into problems trying to use it in a multiple container context.
    It sounds like you've figured out how to run the text through multiple containers directly from ActionScript, which does work well. You can then attach an EditManager to make the text editable. And as the documentation states, you can use the format object on the ContainerController to change container-level formatting (like columns). But if I'm understanding you correctly, you're trying to get the text to change something like fontSize or fontStyle as it flows between containers. That's not something TLF supports yet, and it's not a simple feature to add (either in TLF or your own code).

  • Flowcomposer updateAllControllers Error #1009

    Hello Forum,
    I get Error #1009 when I'm calling flowcomposer.updateAllControllers of my textflow AND the text is too big to fit in my container...
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at flashx.textLayout.compose::BaseCompose/parcelHasChanged()
    at flashx.textLayout.compose::BaseCompose/advanceToNextParcel()
    at flashx.textLayout.compose::BaseCompose/fitLineToParcel()
    at flashx.textLayout.compose::ComposeState/composeNextLine()
    at flashx.textLayout.compose::BaseCompose/composeParagraphElementIntoLines()
    at flashx.textLayout.compose::BaseCompose/composeParagraphElement()
    at flashx.textLayout.compose::ComposeState/composeParagraphElement()
    at flashx.textLayout.compose::BaseCompose/composeBlockElement()
    at flashx.textLayout.compose::BaseCompose/composeInternal()
    at flashx.textLayout.compose::ComposeState/composeInternal()
    at flashx.textLayout.compose::BaseCompose/composeTextFlow()
    at flashx.textLayout.compose::ComposeState/composeTextFlow()
    at flashx.textLayout.compose::StandardFlowComposer/http://ns.adobe.com/textLayout/internal/2008::callTheComposer()
    at flashx.textLayout.compose::StandardFlowComposer/internalCompose()
    at flashx.textLayout.compose::StandardFlowComposer/updateToController()
    at flashx.textLayout.compose::StandardFlowComposer/updateAllControllers()
    Does anyone know why I get this error? My solution now is to just ignore the error with a try and catch...it works, but I don't like it....

    O.k.! I was making a small test to try and reproduce the error:
    package {
    import flash.display.Sprite;
    import flashx.textLayout.formats.TextLayoutFormat;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    public class Test extends Sprite
      public function Test() {
       var tekstLayoutFormat:TextLayoutFormat = new TextLayoutFormat();
       var cs:Sprite = new Sprite();
       addChild(cs);
       var textFlow:TextFlow = new TextFlow();
       textFlow.format = tekstLayoutFormat;
       textFlow.flowComposer.addController(new ContainerController(cs, 400, 10));
    //   textFlow.flowComposer.updateAllControllers();
       var paragraphElement = new ParagraphElement();
       var spanElement = new SpanElement();
       spanElement.text = "sdgfsd";
       spanElement.fontSize = 70;
       paragraphElement.addChild(spanElement);
       textFlow.addChild(paragraphElement);
       textFlow.flowComposer.updateAllControllers();
    i get this result:
    but when I call textFlow.flowComposer.updateAllControllers(); twice (also earlier in the test-program), i get this result:
    Why is there a difference?

  • Auto resize width height in TextFlow controller

    HI,
    We are facing the problem in auto resize width height in TextFlow controller. Content is overlaping withing the controller or sometimes it's seems like not full containt displaying on the control.
    We are writing the below code in the flashx.textLayout.events.CompositionCompleteEvent listiner to orgnize the above step:
         var controller:ContainerController = new ContainerController();
         textFlow.flowComposer.composeToPosition();
         var contentBounds:Rectangle = _controller.getContentBounds();
       _controller.setCompositionSize(_controller.compositionWidth, contentBounds.height);
       textFlow.flowComposer.addController(_controller);
       textFlow.flowComposer.updateAllControllers();
    Please correct if are missing any steps above.
    Regards,
    R.BS

    Hi,
    I have got the solution on my last query. Below is the code to get rid of the content display and auto adjust the width & height of the controller:
    var textHeight:int = Math.ceil(_controller.getContentBounds().height);
       if (textHeight > _controller.compositionHeight) {
         TextDataHeight = textHeight + 12;
                   _controller.setCompositionSize(TextDataWidth ,TextDataHeight);
                   textFlow.flowComposer.updateAllControllers();
    I have also set the TextDataHeight = 50 to display complete paragraph text.
    Due to this I have one problem arise that is indentation of the paragraph content or bulleted text on my content.
    Is any one have the solution on this?
    Looking forward for your response.
    Regards,
    R.BS

  • Textflow link element doesn't work after append to an existed textflow

    It's a strange problem
    I have two textflow container : RichEditableText
    the first one I new the textflow2 everytime I clicked the button,and append a link returned by getElement
    the second one I initially new a textflow and reused it to append new link returned by the same function getElement
    but the strange thing is , the first one works just fine ,but the second one 's link seems invalid with no hand cursor nor function
    thanks a lot for any clue or comment
    <?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="400" minHeight="300">
            <s:layout>
                    <s:BasicLayout/>
            </s:layout>
            <fx:Script>
                    <![CDATA[
                            import flashx.textLayout.elements.LinkElement;
                            import flashx.textLayout.elements.ParagraphElement;
                            import flashx.textLayout.elements.SpanElement;
                            import flashx.textLayout.elements.TextFlow;
                            [Bindable] public var textFlow:TextFlow = new TextFlow();
                            [Bindable] public var textFlow2:TextFlow = new TextFlow();
                            protected function button1_clickHandler(event:MouseEvent):void
                                    textFlow2 = new TextFlow();
                                    textFlow2.addChild(getElement());
                                    textFlow.addChild(getElement());
                            private function getElement():ParagraphElement{
                                    var linkSpan:SpanElement = new SpanElement();
                                    linkSpan.text = "link";
                                    var link:LinkElement = new LinkElement();
                                    link.addChild(linkSpan);
                                    link.href = "event:ok"
                                    var p:ParagraphElement = new ParagraphElement();
                                    p.addChild(link);
                                    return p;
                    ]]>
            </fx:Script>
            <fx:Declarations>
                    <!-- -->
            </fx:Declarations>
            <s:RichEditableText editable="false" text="RichText" width="180" height="165"  textFlow="{textFlow2}" />
            <s:RichEditableText editable="false" x="196"   text="RichText" width="180" height="165" textFlow="{textFlow}" />
            <s:Button x="116" y="217" label="button" click="button1_clickHandler(event)"/>
    </s:Application>

    Thanks for your timely reply!
    I swtiched to tlf2.0 and replaced the two as files downloaded from tlt homepage, the problem seems gone.
    But here's another one !
    The link worked only some firstly added ones, the next added ones can not click.
    repoduce steps
    use the code below with tlf2.0 and flex sdk4.1 updated version
    click the button few more times till the scroller begin to work
    check the links at the bottom, they don't work,
    <?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="400" minHeight="300"> 
        <s:layout> 
            <s:BasicLayout/> 
        </s:layout> 
        <fx:Script> 
            <![CDATA[ 
                import flashx.textLayout.elements.LinkElement; 
                import flashx.textLayout.elements.ParagraphElement; 
                import flashx.textLayout.elements.SpanElement; 
                import flashx.textLayout.elements.TextFlow; 
                [Bindable] public var textFlow:TextFlow = new TextFlow(); 
                [Bindable] public var textFlow2:TextFlow = new TextFlow(); 
                protected function button1_clickHandler(event:MouseEvent):void 
    //                textFlow2 = new TextFlow(); 
    //                textFlow2.addChild(getElement()); 
                    textFlow.addChild(getElement());                
                    textFlow.flowComposer.updateAllControllers(); 
                    scrollerChat.verticalScrollBar.value = ret.contentHeight; 
                private function getElement():ParagraphElement{ 
                    var linkSpan:SpanElement = new SpanElement(); 
                    linkSpan.text = "link"; 
                    var link:LinkElement = new LinkElement(); 
                    link.addChild(linkSpan); 
                    link.href = "event:ok" 
                    var p:ParagraphElement = new ParagraphElement(); 
                    p.addChild(link); 
                    return p; 
            ]]> 
        </fx:Script> 
        <fx:Declarations> 
            <!-- --> 
        </fx:Declarations> 
        <s:RichEditableText id="ret2" editable="false" text="RichText" width="180" height="271"  textFlow="{textFlow2}" />
        <s:Scroller id = "scrollerChat" x="193"  width="180" height="271" verticalScrollPolicy="on" >
            <s:RichEditableText id="ret" editable="false"    text="RichText" textFlow="{textFlow}"  y="0"/>
        </s:Scroller>
        <s:Button x="381" y="9" label="button" click="button1_clickHandler(event)"/>
    </s:Application>

  • TextFlow inside a Resizable Container

    Hi,
    I've been looking for a solution for an issue for a while and hope someone can help me here.
    I have a TextFlow rendered in a Sprite. The sprite is inside a resizable container. When the container is resized, the new sprite size is update in the container controller. The problem is that the text is been deformed.
    This is an image of the text before been scaled.
    And this one is after been scaled:
    I'm not changing the the font size or anything else, just width and height of the sprite.
    Any ideas?

    Here's more information about this issue.
    When the parent container is scaled by the user, this is how I'm updating the TextFlow:
    textFlow.flowComposer.removeAllControllers();
    var newPageController:ContainerController = new ContainerController( container, w, h );
    var controllerFormat:TextLayoutFormat = new TextLayoutFormat();
    newPageController.format = controllerFormat;
    textFlow.flowComposer.addController( newPageController );
    Any comments will be appreciated.

  • Accessing raw text of TextFlow and performing a search

    I am trying to figure out the best way to perform a search
    within a TextFlow to locate a specific piece of text (either a word
    or set of words).
    I have had a hard time figuring out how to actually gain
    access to the raw text of the TextFlow that is loaded. Once that is
    loaded, I need to be able to search through that text, find the
    location of the text, and show that container.
    Essentially add search capability to the Pagination example.
    The only thing I can think of that seems like it may work
    would be to export the TextFlow into an XML file, then perform the
    search on the XML file. Once that is done, I would have to figure
    out which position in the xml file the text was located, and load
    the container with that position....
    Surely there is a better way?
    Thanks, Tim

    I think so - here's how I'd reccomend approaching the
    problem.
    Given a TextFlow I'd do a getFirstLeaf. That returns a
    FlowLeafElement. I'd then look at the FlowLeafElement.text property
    to access the text for matching. To advance to the next leaf
    element use FlowLeafElement.getNextLeaf.
    You'll have to do some book keeping when you find a match to
    figure out the absolute position of the beginning of the match.
    Next step would be to use
    textFlow.flowComposer.findControllerIndexAtPosition to figure out
    which container has the matched text.
    Adding niceties you could search a paragraph at a time by
    taking advantage of the limitElement parameter to getNextLeaf.
    After calling getFirstLeaf call getParagraph to find the paragrah
    and use that as the limit element. To advance to the next paragraph
    use null as the limit element and call getParagraph again for the
    new limit element.
    Hope that helps.
    Richard

  • Weekly build notes listings

    Since there are major changes going on in the TLF weekly builds, and the ASDocs aren't up to date, and the changes made are not searchable, I thought people might want the list dumped on here so changes to particular classes would show up in a forum search.  To see the changes made in Build 360, check out the TLF Blog post on it ( http://blogs.adobe.com/tlf/2009/02/tlf_api_changes_in_build_370_1.html ).
    Here's the list.  Maybe this could become a common practice.
    Build 432, Fri May 15 2009
    Changes in build 437 (2009/05/22)
        * remove flashx.textLayout.edit.UndoManager and flashx.textLayout.IUndoManager
        * Fix 2330964 BackgroundColor Placed incorrectly from TextLineFactory. Actually was in 436.
        * Fix 2326588 TextContainerManager Does Not Support Background Color
        * Fix 2330946 Remove TextContainerManager.trunctationOptions property
        * Fix 2337918 Please expose the scrollToPosition() API in TextContainerManager
        * Fix 2336672 Preserve selection when switching editingMode in TextContainerManager
        * Setting editingMode to the current editingMode should do nothing in TextContainerManager
    Changes in build 436 (2009/05/22)
        * Fix 2331711 TextContainerManager now sends a DamageEvent from setText().
        * Fix 2326543 bug where selection wasn't being extended on mouse drag.
        * add [RichTextContent] metadata to SpanElement and FlowGroupElement mxmlChildren properties
        * Fix 2337740 Flex bug SDK-20964 TCM rcycling bug
        * Partial fix 2330964 background color placed incorrectly from TextLineFactory
        * Remove vestigal experiment with Tables code
        * Fix 2321538. On the Mac, the keyboard shortcuts for cmd-A,C,V,X were not working.
        * Fix 2326543, "drag select of scrolling flows doesn't expand selection".
        * Fix 2329527. Content bounds being reported was slightly different between the factory and TextFlow composer.
        * Fix 2328695 TextContainerManager Stops Receiving FocusIn Events. This is a complete fix - previously this bug was worked around
        * Added TextLineFactoryBase.isTruncated
        * Fix 2315119 - Graphic will be redrawn when link applied.
    Changes in build 434 (2009/05/22)
        * Fix 2323921: RichText truncation doesn't work in all cases
    Build 432, Fri May 15 2009
    Changes in build 432 (2009/05/14)
        * Fixed regression that broke truncation feature
        * Added TextLineFactoryBase.isTruncated
        * Changed text line factory behavior such that scrolling is turned off when truncation options are set
    Build 427, Fri May 8 2009
    Changes in build 427 (2009/05/07)
        * Fix bug - RTE in computeSelectinIndexInContainer
        * Namespace change -- mxml namespace for TLF was "library:adobe/flashx/textLayout". Now it is: library://ns.adobe.com/flashx/textLayout".
        * Fix bug - Scrolled TextContainerManager Can be Difficult To Create Point Selection
    Changes in build 426 (2009/05/06)
        * Fix bug - TextFlow double-deletes text when pressing the backspace or delete key
    Build 422, Fri May 1 2009
    Changes in build 422 (2009/04/30)
        * API Changes: TextContainerManager now has a getContentBounds function, in place of individual getters for contentLeft, contentTop, etc. ContainerController also now has a getContentBounds function, in place of individual getters. Added functions to TextContainerManager to support custom classes for ISelectionManager and IEditManager (see createSelectionManager and createEditManager).
        * API changes for TextContainerManager:
              o getInteractionManager renamed to beginInteraction(), and added a new function endInteraction() which clients should use after beginInteraction() to signal that they are done with selecting/editing. This tells the TextContainerManager that it can go back to factory mode, which is more efficient.
              o invalidateInteractionManager() removed and replaced with two new functions, invalidateSelectionFormats() which clients should called when SelectionFormats have changed, and invalidateUndoManager which clients should call to change the undo manager.
        * API Changes for InputManager
              o InputManager renamed as TextContainerManager
              o IInputManagerClient removed, now you can subclass InputManager and override its methods
        * API Changes:
              o InputManager
                    + damaged property renamed to isDamaged() function
                    + focusSelectionFormat renamed to focusedSelectionFormat
                    + container retyped to Sprite
                    + compositionWidth and compositionHeight removed as constructor parameters, now you need to set the properties on the InputManager you create
              o ContainerController
                    + container retyped to Sprite
              o ISelectionManager
                    + focusSelectionFormat renamed to focusedSelectionFormat
              o IConfiguration & Configuration
                    + focusSelectionFormat renamed to focusedSelectionFormat
        * API Changes:
              o ISelectionManager
                    + setSelection deselects if negative numbers are passed in.
                    + selectAll removed, you can call ISelection.setSelection() to get the same behavior, if you need to redraw the selection, call ISelectionManager.textFlow.flowComposer.updateAllControllers().
                    + flushPendingEvents moved to IInteractionHandler
                    + notifyInsertOrDelete moved to IInteractionHandler
              o IUndoManager
                    + clear renamed to clearAll().
                    + undoLastOperation renamed to undo()
                    + redoLastOperation renamed to redo()
        * API Change: SelectionEvent now contains a SelectionState, not an ElementRange; this is much cheaper for us to provide. ElementRange is now tlf_internal. ElementRange.firstLeafPosition renamed to absoluteStart, ElementRange.lastLeafPosition renamed to absoluteEnd.
        * API Change: TextScrap.copyTextScrap renamed to clone.
        * API Changes to InputManager. defaultInputManagerConfiguration renamed to defaultConfiguration. composeToController renamed to compose(), and updateToController renamed to updateContainer().
        * API Changes:
              o ISelectionManager:
                    + Event handling functions moved out of ISelectionManager into new interface, IInteractionHandler
                    + selectionFormat renamed to currentSelectionFormat
                    + selectionState renamed to function getSelectionState()
                    + setSelection now takes default parameters to select the entire flow
                    + noFocusSelectionFormat renamed to unfocusedSelectionFormat
              o SelectionFormat:
                    + blockAlpha reanmed to rangeAlpha
                    + blockBlendMode renamed to rangeBlendMode
                    + blockColor renamed to rangeColor
              o IEditManager:
                    + added get undoManager()
                    + added changeElementID()
                    + added changeElementStyleName()
              o SelectionManager:
                    + activeMark and anchorMark are now private
                    + selectionChanged is private
                    + setSelectionState is tlf_internal
              o EditManager:
                    + stage is private
                    + ChangeElementIdOperation renamed to ChangeElementIDOperation
    Changes in build 420 (2009/04/28)
        * API change: Removed the misleadingly named and superfluous TextFlowLine.textIndent. Documented and ensured consistent use of TextFlowLine.lineOffset as lhe line's offset in pixels from the appropriate container inset (as dictated by paragraph direction and container block progression), prior to alignment of lines in the paragraph.
        * API change: more changes to the factory classes. ITextLineCreator is now a property of the base class, so instead of passing it in the constructor you construct and then set the property in the factory. bounds property renamed to compositionBounds, and measuredBounds renamed to contentBounds. containerController property is now private.
        * API Change: moved ITextLineCreator interface from the elements package to the compose package.
        * PlainTextExporter is now public and has methods for controlling the paragraphSeparator and whether discretionary hyphens are included in the export. To use it, you can either construct it directly, or via the TextFilter class. Removed the newlineIndicator string from IConfiguration.
        * Fixed a bug where tabs in RTL text were being being offset by textIndent and marginRight values.
    Changes in build 419 (2009/04/24)
        * Once a mouseWheel event has been handled, mark with preventDefault so client applications don't also try to handle it.
        * Don't start compose if text is already composed. Optimization for callers of composeToPosition.
        * Always call resetContentTopLeft, to give more accurate top left positions, particularly for cases where the text is outdented and left aligned.
        * API CHANGE: TextLineFactory revised. It is now split into 3 classes, TextLineFactoryBase, StringTextLineFactory, and TextFlowTextLineFactory. Use StringTextLineFactory for creating TextLines from a String. Use TextFlowTextLineFactory for creating TextLines from a TextFlow. Static methods have been removed, so create a new factory in order to create lines. One factory may be reused many times, just resetting the values (text, bounds, truncation options, etc.) in between. See StaticHelloWorld.as for a simple example of how this works for Strings, see StaticTextFlow.as for a simple example of it with TextFlows.
    Build 418, Fri Apr 24 2009
    Changes in build 418 (2009/04/23)
        * API CHANGE: TextLineFactory revised. It is now split into 3 classes, TextLineFactoryBase, StringTextLineFactory, and TextFlowTextLineFactory. Use StringTextLineFactory for creating TextLines from a String. Use TextFlowTextLineFactory for creating TextLines from a TextFlow. Static methods have been removed, so create a new factory in order to create lines. One factory may be reused many times, just resetting the values (text, bounds, truncation options, etc.) in between. See StaticHelloWorld.as for a simple example of how this works for Strings, see StaticTextFlow.as for a simple example of it with TextFlows.
    Changes in build 417 (2009/04/22)
        * Fixed Vertical Justification behavior; it now increases the spacing between consecutive lines proportionally rather than spacing lines uniformly.
        * API Changes: Renamed DisplayObjectContainerController to ContainerController, and removed IContainerController and IInternalContainerController. Wherever you used to use "IContainerController" or "DisplayObjectContainerController" now just use "ContainerController".
              o Moved some functions that were public into the tlf_internal namespace: effectivePaddingLeft, effectivePaddingTop, effectivePaddingRight, and effectivePaddingBottom.
              o ColumnState.createColumnState removed. A ColumnState constructor now takes all the relevant values, so whereever you used to do this:
                    + var columnState:ColumnState = ColumnState.createColumnState(...your values here...);
              o you can now do this:
                    + var columnState:ColumnState = new ColumnState();
              o ColumnState.getColumnAtIndex(index) has been renamed to getColumnAt(index). So, once you have the columnState, you do, for instance:
                    + var columnRect:Rectangle = getColumnAt(0);
        * Fixed bug where spaces at end of a line would "overflow" into neighboring columns. New code keeps drawing of cursor at the column boundary and limits block selection drawing to the same bounds.
        * Enhancement to cursor navigation for Right to Left text systems. Previous code moved cursor according to logical order vs. visual order. Result was that a right arrow key press in Arabic, Hebrew or other RTL languages meant that the cursor actually moved left. New code moves cursor according to the visual order of the text based on the direction of the entire text flow. Note that changing the direction on a paragraph will not alter the behavior of the cursor, nor will the presence of LTR text within a RTL text flow. This means that if a TextFlow is set to Right to Left and a given paragraph is entirely in English and the paragraph is set to be Left to Right, the cursor will seem to move in the wrong direction. TLF does not support customization of cursor movement based on the locale or direction of anything except the parent TextFlow.
        * Fixed a bug that caused undoing an ApplyFormatToElementOperation to have no effect.
        * API Changes:
              o DisplayObjectContainer event handling functions renamed:
                    + processMouseOverEvent -> mouseOverHandler
                    + processMouseOutEvent -> mouseOutHandler
                    + processMouseWheelEvent -> mouseWheelHandler
                    + processMouseDownEvent -> mouseDownHandler
                    + processMouseUpEvent -> mouseUpHandler
                    + processMouseMoveEvent -> mouseMoveHandler
                    + processMouseDoubleClickEvent -> mouseDoubleClickHandler
                    + processFocusInEvent -> focusInHandler
                    + processFocusOutEvent -> focusOutHandler
                    + processActivateEvent -> activateHandler
                    + processDeactivateEvent -> deactivateHandler
                    + processKeyDownEvent -> keyDownHandler
                    + processKeyUpEvent -> keyUpHandler
                    + processTextInputEvent -> textInputHandler
                    + processContextMenuSelectHandler -> menuSelectHandler
                    + eventHandler -> editHandler
              o ISelectManager & SelectionManager & EditManager renamings:
                    + eventHandler -> editHandler
        * API Changes: renamed IContainerController.scrollLines to getScrollDelta, renamed InputManager.scrollLines to getScrollDelta, and removed constants for default container width and height.
    Changes in build 412 (2009/04/10)
        * API CHANGE: DisplayObjectContainerController methods processCopyEvent, processCutEvent, processPasteEvent, processSelectAllEvent collapsed into a single processEvent that handles all these basic events. Added to ISelectionManager a new function, processEvent for handling these same events in the SelectionManager, and removed processSelectAll, which is no longer used. cutTextScrap and pasteTextScrap moved from ISelectionManager to IEditManager, since these are editing operations.
    Build 411, Fri Apr 10 2009
    Changes in build 411 (2009/04/09)
        * Fixed a bug where noFocus selection format was not being set on re-activation
        * API CHANGES. These functions in IFlowComposer were renamed:
              o updateContainer -> updateToController
              o updateAllContainers -> updateControllers
              o composeContainer -> composeToController
              o composePosition -> composeToPosition
        * API CHANGE: Changing name of TextFlow.hostTextLayoutFormat to hostFormat
    Changes in build 410 (2009/04/08)
        * Fix bug where leading info used for composing the next line was being saved prematurely, causing incorrect layout if the current line needed to be composed in multiple passes.
    Build 409, Tue Apr 7 2009
    Changes in build 409 (2009/04/07)
        * Fix bug where clicking on container when height or width NaN doesn't work. When measuring, transparent hit detect region wasn't being redrawn to correct size after composition.
        * API CHANGE: Plain-text import/export changes. Newline indicators exported based on setting in IConfiguration.newLineIndicator. On import, LF/CR/CR+LF are all recognized as new line indicators.
        * Compose to container size with scrolling on -- previously was composing to double composer size. This may flush out some invalid line bugs.
        * Fixed a bug with blockProgression="rl" and compositionWidth=NaN, lines were getting improperly clipped out so that no text appeared.
        * API CHANGE: Renaming functions in IFormatResolver. invalidateAllTargets is now invalidateAll, and invalidateTarget is now invalidate. resolveTextLayoutFormat is now resolveFormat.
        * API CHANGE: eventMirror on FlowLeafElement and SubParagraphGroupElement is now tlf_internal.
        * API CHANGE: Moving TextRange from the edit package to the elements package.
    Changes in build 406 (2009/04/02)
        * API CHANGE: Renaming DamageEvent.damageStart to damageAbsoluteStart.
        * API Change: IConfiguration.includePartialLine renamed to overflowPolicy. Defined new class OverflowPolicy that describes the different policies that can be used to control whether lines that fall at the end of the container are included in the container, or not.
    Changes in build 405 (2009/04/01)
        * API CHANGE: IFlowComposer.firstDamagePosition renamed to damageStartPosition.
        * API CHANGE: Rename GeometryUtil.getRangeBounds to GeometryUtil.getHighlightBounds.
        * API CHANGE: ParagraphElement.getText now takes an additional optional parameter that specifies the terminator for the paragraph. By default, this is the Unicode paragraph terminator character (\u2029), but you can make it whatever you want, including a simple newline by passing a String for the paragraphTerminator. This change is backwards compatible for current callers of getText().
        * Fix clipping problem when text is placed above the container (6 lines aligned verticalAlign = bottom in a space that fits 4 lines).
    Changes in build 404 (2009/03/31)
        * Updating typgraphic case --Markup and API Change-- Now uses a new class TLFTypographicCase, and has different options. Support for "title" and "caps" dropped. Use TLFTypographicCase with TLF in preference to flash.text.engine.TypographicCase. "smallCaps" renamed to "capsToSmallCaps". "capsAndSmallCaps" renamed to "lowercaseToSmallCaps". Also made AUTO the default setting for kerning, which matches FXG spec.
    Changes in build 403 (2009/03/30)
        * format Markup Changes:
              o <TextLayoutFormat> now <format>
              o When referring to a format id, don't use brackets. So this:
                <TextLayoutFormat id="english" locale="en" fontFamily="Minion Pro"/>
                <p marginBottom="15" ><span format="{english}">This text is supposed to be in Minion Pro via a named character attribute</span></p>
                Is now this:
                <format id="english" locale="en" fontFamily="Minion Pro"/>
                <p marginBottom="15" ><span format="english">This text is supposed to be in Minion Pro via a named character attribute</span></p>
        * API Changes:
              o Rename FlowElement.textLayoutFormat -> format
              o Rename FlowElement.computedTextLayoutFormat -> computedFormat
              o Rename IContainerController.textLayoutFormat -> format
              o Rename IContainerController.textLayoutFormat -> computedFormat
              o Rename DisplayObjectContainerController.textLayoutFormat -> format
              o Rename DisplayObjectContainerController.textLayoutFormat -> computedFormat
    Changes in build 402 (2009/03/27)
        * verticalAlign of "middle" or "bottom" will now align to the compositionHeight (or compositionWidth in vertical text) even if the height of the text exceeds the compositionHeight. This means that lines that don't fit may be get pushed above the box, or (for middle) pushed both above and below. It also means that all lines will forced to compose to the end, so it will be quite slow to use verticalAlign in large text flows. Made some corresponding fixes to scrolling to make it work with text off the start of the container. Added some new test cases to exercise this functionality in all the different alignment settings.
        * Scrolling fixes for next/previous line with arrow keys. Fix a bug where the arrow key would move to the end of the line if the line required composition (e.g., the line was not previously in view). Also fixed a bug when scrolling up by a line where it would scroll down instead.
        * doOperation used to return an SelectionState, but with the exception of two places that were using it internally, all external callers only checked to see if it was null or not. null was being used to indicate failure, or nothing changed, which means that the operation is not placed on the undo stack. Now it returns a Boolean, true for success, false for failure. There may be further changes in this area to make FlowOperations simpler.
    Changes in build 397 (2009/03/20)
        * Made DisplayObjectContainerController's and FlowElement's TextLayoutFormat properties read/write (used to be write-only).
        * Merge ContainerControllerBase class into DisplayObjectContainerController.
        * Mark TextFlow class as final
    Changes in build 396 (2009/03/19)
        * Fix RTE in StandardFlowComposer.releaseLines
        * Fix possible source of the RTE on null reference from findFirstAndLastVisibleLines in ContainerControllerBase.
    Changes in build 394 (2009/03/17)
        * Fix issue with changes made in StatusChangeEvent to embedded graphics by blocking recursive composition. Bug 2298043
        * Add IFlowComposer.composeInProcess property.
        * Fixed problem where first part of a link could not be replaced by a new link. New code allows partial replacement of a link element with a selection which starts at the first character.
        * Fixed a problem where the cursor was getting set to the I-beam, and wouldn't set back.
    Changes in build 393 (2009/03/16)
        * Fix a bug where keyboard navigation with linked containers was causing a scroll because it was trying to scroll to a position not in the container.
    Changes in build 392 (2009/03/13)
        * Removed optimization that was preventing scrolling in the logical width direction if scrolling in the logical vertical direction was turned off.
        * Removed the container-level mouseMove and rollOver handlers which were changing the link state. These are now part of the LinkElement, and added only when they are needed.
    Changes in build 390 (2009/03/11)
        * Fix for application of attributes to a point selection where only the last attribute would be applied. New code applies all attributes applied to the point.
        * IContainerController.contentWidth (or contentHeight in vertical text) is now based on the actual text width, not the unjustified text width. This fixes some problems where scrolling wasn't working correctly because the reported width of the text was greater than the compositionWidth, but lines were wrapped. It does mean that to get the unjustified width you will have to set the textAlign to something other than "justify", recompose, and then get the resulting width.
        * Fix for unintended scroll when at the end of a TextFlow.
        * Fix for RTE when dragging over text generated from a factory, or non-TLF TextLines.
        * Changes for alignment and measurement. You can now set NaN for compositionWidth or compositionHeight, and TLF will compose and use the generated contentWidth or contentHeight for alignment, scrolling, etc. The composer now generates a topLeft for the bounds, so you can make a full "content bounds" using contentLeft, contentTop, contentWidth, and contentHeight.Note that this is logical bounds and not inked bounds, so there are some circumstances where ink will not fit in the content bounds.Fixed bugs in how the factory was doing vertical alignment that caused it to be a few pixels off.Fixed some incosistencies between how the standard flow composer worked and how the factory's simple composer works -- composition results should now be more uniform. Added a new test program, MeasurementGrid, for testing all this. It's still a work in progress.
    Changes in build 388 (2009/03/09)
        * Fixed issue where applying link or TCY to the last span of a paragraph caused a dangling span to remain with the para terminator.
        * Fixed issue where text would go into a link when it was the last element in a paragraph. Newly typed text now goes into a new span when the selection marker is at the last index.
    Changes in build 386 (2009/03/06)
        * Fixed issue with placement of underline and strikethrough on inline images.
        * Fixed placement of underline and strikethrough on text which has a baseline shift applied to it.
    Changes in build 385 (2009/03/04)
        * Combined SWC 'textLayout.swc' now included in the libs directory of the build. This includes everything from textLayout_core, textLayout_edit, and textLayout_conversion.
        * Combined RSLs now included in the rsl directory of the build. Both an unsigned SWF and signed SWZ are created. These include everything from textLayout_core, textLayout_edit, and textLayout_conversion.
    Changes in build 382 (2009/03/02)
        * Fix issue with composing a TextFlow containing just an empty ParagraphElement.
        * TextLineFactory will generate lines that included InlineGraphics whose source is a "class" - normally an embedded graphic.
        * Expose eventMirrors - use FlowElement.getEventMirror function to access the eventMirror.
    Changes in build 381 (2009/02/27)
        * Fixed issue with graphic assigned to ILG getting the wrong sizing.
        * Factory instance functions renamed to textLinesFromString and textLinesFromTextFlow. Static functions renamin unchanged.
    Changes in build 380 (2009/02/26)
        * Made backgroundColor work with TextLineFactory. This required an API change - the callback to the factory now must take a DisplayObject as its parameter, since it won't always be passed TextLines. Also, the background shapes themselves no longer include leading, so they do not exactly coincide with the selection bounds. This was another change to support calculating the shapes during composition as opposed to afterward. Also added a snapshot test as part of FactoryImportTest that uses backgroundColor, in addition to updating the existing unit tests.
    Changes in build 379 (2009/02/25)
        * Fixed for multiple containers ( we were getting incorrect textLength in the containers), as well as a fix that forces scrollToPosition to compose if the text isn't composed yet.
        * Fix so that we scroll to the active position of the selection after we extend the selection with a keyboard event. Also fixed some of the TextRangeUtil functions used for nextLine, etc. to make sure text is composed through selection before processing that depends on composition results.
        * Plain text import now consistently converts \r to space; previously it was converting only the first one. Still not clear what correct behavior should be.
    Changes in build 377 (2009/02/23)
        * Fix bug with importing trailing empty div elements.
    Changes in build 374 (2009/02/18)
        * Added support for TextField-style leading. A new leading model value allows lineHeight to be interpreted as the distance of line's ascent from the previous line's descent. Further, lineHeight can be negative. which specifies the criteria for truncation, the string used to indicate truncation and the format for this string.
    Changes in build 372 (2009/02/16)
        * Added "enableAccessibility" property to IConfiguration, defaults to false. Allows clients to avoid paying price for TextAccImpl objects unless needed.
        * Added support for truncation for text composed using TextLineFactory. The TextLineFactory methods now take a truncation options parameter, which specifies the criteria for truncation, the string used to indicate truncation and the format for this string.
    Changes in build 371 (2009/02/13)
        * Fixed a number of bugs relating to scrolling by line.
        * Measurement changes. Changed the way contentHeight and contentWidth are calculated, now they reflect the size of the text, regardless of alignment. Eliminated unjustifiedContentHeight and unjustifiedContentWidth; use contentHeight and contentWidth instead.
        * Fix RTE in damage when we try to damage back one line, for textFlow that doesn't have any leaf nodes.
        * Changed InlineGraphicElement so that GraphicElements (and the TextBlocks they are part of) don't get released. Fixes RTE on null pointer in places where we access the GraphicElement.
        * Fix bug deleting all of the last Span of a paragraph, plus some of the following paragraph.
    Changes in build 370 (2009/02/12)
        * Removed textFlow property from CompositionCompletionEvent. Use event.target to get to the TextFlow.
    Changes in build 369 (2009/02/11)
        * Fix issues in usage of hostTextLayoutFormat
        * Fix FXG export to not export styles with value "inherit"
        * lineBreak property no longer inherits by default
    Changes in build 368 (2009/02/10)
        * Fix for RTE that happens after cancelling an operation (calling preventDefault on a FlowOperationEvent).
    Changes in build 367 (2009/02/09)
        * ported to Flex 4.0.0.4836. All SWCs now build with this SDK.
    Changes in build 366 (2009/02/06)
        * FlowGroupElement addChild, addChildAt and replaceChildren methods now automatically delete new elements from any existing parents. Previously the code would test for parent on new elements and throw.
        * mxmlChildren FlowElement property which is normally used for mxml compilation of TextFlow objects now always deletes existing children
        * Fix a memory leak issue with the TextLayoutFormat cache
        * Fix cascade bug with non-inheriting attributes getting inherited
    Changes in build 365 (2009/02/05)
        * Changed TextLayoutFormat.backgroundColor to allow setting value of "transparent" (now the default). Because of this new value for backgroundColor, backgroundAlpha now defaults to 1.
    Changes in build 364 (2009/02/04)
        * Performance improvement for handling of TextFlow.hostTextLayoutFormat. The code now assumes that once set by the client the supplied object won't be changed. This avoids a copy.
    Changes in build 363 (2009/02/03)
        * Performance work. Remove getCanonical from TextLayoutFormat.
        * Fix for RTE cancelling SplitParagraphOperation.
        * Fixing some float bugs.

    Try searching discussions--see: http://discussions.apple.com/thread.jspa?threadID=684662
    only caveat is link is dated-I googled for newer...
    MacBook Pro 17" Mac mini (Intel)   Mac OS X (10.4.8)  

  • Unable to load embedded fonts in TLF using SWFContext

    Hi,
        We are having issues with embedding/renderring fonts in swf.
        Here is the code of the slide1.swf compiled by mxmlc.exe [Adobe Flex Compiler (mxmlc) Version 4.1.0 build 16076] with compiler parameters --  "-static-link-runtime-shared-libraries".  and using Flash player version 10.1, 10.2 & 10.3.
        package
            import flash.display.Sprite;
            import flashx.textLayout.compose.ISWFContext;
            public class Slide1 extends Sprite implements ISWFContext
                [Embed(source="C:/WINDOWS/FONTS/CALIBRI.TTF", fontName="Calibri", embedAsCFF = "true", unicodeRange="U+0041,U+0072,U+0069,U+0061,U+006C,U+0020,U+004E,U+006F,U+006D", mimeType="application/x-font")]
                public static const calibri:Class;
                [Embed("slide1/sldBg1.png", mimeType="image/png")]
                public static const bg:Class;
                [Embed("slide1/slide1.xml", mimeType="application/octet-stream")]
                public static const slide:Class;
                public function callInContext(fn:Function, thisArg:Object, argsArray:Array, returns:Boolean=true):*
                    if (returns)
                    return fn.apply(thisArg, argsArray);
                    fn.apply(thisArg, argsArray);
        Using Flex 4.1 SDK:--
            When I load the slide1.swf in FB4 ActionScript Project it shows the embedded text. // Output is fine
            But, when I load the slide1.swf in FB4 MX+Spark Flex Project, it gives an error :
            Warning: An ActionScript 1.0/2.0 SWF file has loaded an ActionScript 3.0 SWF; code in the ActionScript 3.0 SWF will not run.
            Error TypeError: Error #1034: Type Coercion failed: cannot convert Slide1@f56fce9 to mx.core.IFlexModuleFactory. !
            Below is the code where the exception occurs.
            var fontClass:Class = ApplicationDomain.currentDomain.getDefinition("Slide1") as Class;
           textFlow.flowComposer.swfContext = new fontClass();   // Exception occurs here
            textFlow.flowComposer.addController(new ContainerController(textContainer, containerWidth, containerHeight));   
            textFlow.flowComposer.updateAllControllers();           
            textFlow.flowComposer.composeToPosition();
            And, when I load the slide1.swf in FB4 MX Flex Poject, it shows the embedded text.  // Output is fine
        Using Flex 4.5 SDK:--
            With FB4 MX+ Spark and MX only Flex Project we get following errors
            VerifyError: Error #1053: Illegal override of createGeometry in flashx.textLayout.elements.FlowGroupElement.
            VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.SubParagraphGroupElement.
            VerifyError: Error #1103: Class flashx.textLayout.elements::LinkElement cannot extend final base class.
            VerifyError: Error #1053: Illegal override of display in flashx.textLayout.elements.ContainerFormattedElement.
            VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.FlowLeafElement.
            VerifyError: Error #1053: Illegal override of addParaTerminator in flashx.textLayout.elements.SpanElement.
            VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.InlineGraphicElement.
            VerifyError: Error #1053: Illegal override of minPercentValue in flashx.textLayout.property.NumberOrPercentProperty.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.EnumStringProperty.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.BooleanProperty.
            VerifyError: Error #1053: Illegal override of minValue in flashx.textLayout.property.NumberProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::NumberProperty could not be found.
            VerifyError: Error #1053: Illegal override of minValue in flashx.textLayout.property.IntProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::IntProperty could not be found.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.UintProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::UintProperty could not be found.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.StringProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::NumberOrPercentProperty could not be found.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.ArrayProperty.
            VerifyError: Error #1103: Class flashx.textLayout.elements::TCYElement cannot extend final base class.
            VerifyError: Error #1053: Illegal override of createTextLine in flashx.textLayout.compose.ComposeState.

    We use this for fonts  ----  textFormat.fontLookup = FontLookup.EmbedCFF;
    For showing the fonts we use the line of code :--
    textFlow.flowComposer.swfContext = new fontClass();
    which throws an error
    Error TypeError: Error #1034: Type Coercion failed: cannot convert Slide1@f56fce9 to mx.core.IFlexModuleFactory. !

  • Wrapping: Flex vs. InDesign

    Hi
    Here's a screenshot showing the same text in a PDF from InDesign, and in Flex/TLF/Flash:
    (Sys info below.)
    The fourth line wraps differently in Flex. It would be great if someone
    (perhaps from the TLF team) could help me with finding out why.
    For the project I'm working on, it's crucial that the text wraps
    the same way it does in InDesign. What options do you see to
    ensure that?
    Ideally, all of the text would wrap the same right after TextConverter.importToFlow.
    (But the Flex app could make some adjustments if necessary.)
    Here's a screenshot showing the "s: d" from the first line:
    In the InDesign PDF the colon is a lot closer to the "s" than in Flex, it seems.
    Do you have any idea where the different distances between the
    characters could come from?
    It seems to me as if the TLF has a different way of calculating
    the exact distances/positions (different from the implementation
    in InDesign.) Is that true?
    One aspect that I noticed: The font in the PDF seems bolder.
    Tobi (Sys info and code below.)
    Sys info:
    Flash Builder Beta 2, Windows XP.
    The guy who created the PDF using InDesign says:
            We're using Adobe Single-line composer, the same OTF font, and
            fontsize, with hyphenation off, kerning=0, and tracking="0"
    Code: (Also attached as file.)
    <?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="main()" viewSourceURL="srcview/index.html">
        <fx:Script>
            <![CDATA[
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.elements.TextFlow;
    private var tlfns:Namespace =
        new Namespace('http://ns.adobe.com/textLayout/2008');
    private var cc:ContainerController;
    private var textFlow:TextFlow;
    public var layoutDoc:XML;
    private function main():void {
        layoutDoc = new XML('<frame type="TextFrame" x-offset="72.0000" ' +
            'y-offset="18.0000" width="324.0000" height="411.0000" rotation="0" ' +
            'overflow="false"><TextFlow xmlns="http://ns.adobe.com/textLayout/2008" ' +
            'verticalAlign="top" blockProgression="tb"><div><p textAlign="left" ' +
            'marginTop="0" marginBottom="0"><span fontFamily="Myriad Pro" ' +
            'fontStyle="normal" fontWeight="normal" fontSize="12" lineHeight="14.4" ' +
            'baselineShift="0" textDecoration="none" trackingLeft="0" ' +
            'trackingRight="0" kerning="off">There are two main types of ' +
            'arguments: deductive and inductive. A deductive argument is ' +
            'an argument such that the premises provide (or appear to provide) ' +
            'complete support for the conclusion. An inductive argument is an ' +
            'argument such that the premises provide (or appear to provide) some ' +
            'degree of support (but less than complete support) for the conclusion. ' +
            'If the premises actually provide the required degree of support for ' +
            'the conclusion, then the argument is a good one. A good deductive ' +
            'argument is known as a valid argument and is such that if all its ' +
            'premises are true, then its conclusion must be true. If all the ' +
            'argument is valid and actually has all true premises, then it is ' +
            'known as a sound argument. If it is invalid or has one or more false ' +
            'premises, it will be unsound. A good inductive argument is known as ' +
            'a strong (or “cogentâ€�) inductive argument. It is such that if the ' +
            'premises are true, the conclusion is likely to be true. A fallacy is, ' +
            'very generally, an error in reasoning. This differs from a factual error,' +
            ' which is simply being wrong about the facts. To be more specific, ' +
            'a fallacy is an “argumentâ€� in which the premises given for the ' +
            'conclusion do not provide the needed degree of support. A deductive ' +
            'fallacy is a deductive argument that is invalid (it is such that it ' +
            'could have all true premises and still have a false conclusion). An ' +
            'inductive fallacy is less formal than a deductive fallacy. They are ' +
            'simply “argumentsâ€� which appear to be inductive arguments, but the ' +
            'premises do not provided enough support for the conclusion. In such ' +
            'cases, even if the premises were true, the conclusion would not be ' +
            'more likely to be true.</span></p></div></TextFlow></frame>');
        var sprite:Sprite = new Sprite();
        displayArea.addChild(sprite);
        var layoutDocFrameWidth:Number = parseFloat(layoutDoc.@width);
        var layoutDocFrameHeight:Number = parseFloat(layoutDoc.@height);
        displayArea.width = layoutDocFrameWidth;
        displayArea.height = layoutDocFrameHeight;
        var layoutDocTextFlowXML:XML = layoutDoc.tlfns::TextFlow[0];
        textFlow =
            TextConverter.importToFlow(
                layoutDocTextFlowXML,
                TextConverter.TEXT_LAYOUT_FORMAT
        cc =
            new ContainerController(
                sprite, layoutDocFrameWidth, layoutDocFrameHeight
        textFlow.flowComposer.addController(cc);
        textFlow.flowComposer.updateAllControllers();
            ]]>
        </fx:Script>
        <s:Panel id="display" horizontalCenter="0"
            title="Wrapping Example"
            width="740" height="510">
            <s:layout>
                <s:VerticalLayout
                    paddingTop="20" paddingBottom="20"
                    paddingLeft="20" paddingRight="20"/>
            </s:layout>
            <s:SpriteVisualElement id="displayArea"
                height="100%"/>
        </s:Panel>
    </s:Application>

    Hi everyone,
    Here's an update. The situation has improved, but the problem hasn't been solved yet.
    (Info:
    The TLF text didn't get rendered using the embedded font. In Flash
    Builder Beta 2, the following fixed the issue:
    [Right-clicked on the project] -> Properties -> Flex Build Path ->
      Library Path -> Framework linkage -> Merged into code)
    Wrapping compared to the InDesign PDF:
    System font:
      (Info:
        http://forums.adobe.com/thread/449201
        "Device fonts not only reside on the local system, they are
        rendered by the OS and not by the player. The player does not
        currently have the capability to render them internally." So it
        seems with sys fonts, anti-aliasing opts can't be set in Flex?)
      Wrapping: Line 4 wraps differently.
    Embedded font:
      advancedAntiAliasing: true
        Wrapping: Line 19 wraps differently. All lines before that wrap
        correctly - this situation is much better. Thanks Daniel!
      advancedAntiAliasing: false
        Wrapping: Not different from above (advancedAntiAliasing true).
    This is one version of the CSS rule:
    @font-face {
        src:url('assets/MyriadPro-Regular.otf');
        fontFamily: MyriadProEmbeddedCFF;
        embedAsCFF: true;
        advancedAntiAliasing: true;
    Does anyone have an idea what else I could try to get the wrapping
    in sync? Perhaps some other @font-face properties? Or some other
    properties/settings/etc?
    If nothing works, the finished Flex app will try fix the wrapping.
    But ideally the wrapping would be the same as in the InDesign PDF
    right away.
    Tobi

Maybe you are looking for