Skip navigation
Currently Being Moderated

flowComposer of RichText is null

Jun 28, 2012 6:50 AM

Hi there,

 

First of all - I'm quite new to the whole TLF so maybe this question is just plain stupid. I want to read all of the atoms of a textFlow to parse it into SVG.

I saw some quite good topics around here, so parsing is not the problem. I'm trying the following:

 

var flow:TextFlow = element.textFlow; //element is a RichText instance

                              var num:uint = flow.numChildren;

 

                              for(var i:uint = 0; i<num; i++){

                                        var child:FlowElement = flow.getChildAt(0);

 

                    // Find out the position on screen

                                        var elementStart:int = child.getAbsoluteStart();

                                        var textFlowLine:TextFlowLine = flow.flowComposer.findLineAtPosition(elementStart);               

                                        var lineStart:int = textFlowLine.absoluteStart;

                                        var linkStartInLine:int = elementStart - lineStart;

                                        var tl:TextLine = textFlowLine.getTextLine(true);

                                        var rect:Rectangle = tl.getAtomBounds(linkStartInLine);   

                    trace(rect);

               }

 

The line that is highlighted breaks, this happens because the textFlow has no flowComposer. I digged into the framework and saw that TextFlowTextLineFactory is being used, specifically the method

createTextLines does the following:

 

textFlow.changeFlowComposer(null,false);

 

which nulls the flowComposer.

 

So my question is how do I get the RichText class to stop nulling my flowComposer everytime I set the textFlow Object? Or what is the right way to assign a flowComposer to a textFlow of a RichText?

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points