eldamar
eldamar

Reputation: 659

Getting characters position in TLF

i am trying to figure out if i can in anny way get the exact position for every character inside a textflow?, also I'm having trouble with the TLF documentation, is there anny documentation that shows more on how to work with it in actionscript rather than mxml, im looking to write my own component and perhaps not use richtexteditor if i don't need to.

Many thanks!

Edit: i finally think i figured out how to get each characters position in the textflow:

private function getCharPosition():void {
        for (var i:int=0; i<=textController.flowComposer.numLines; i++) {
            var textFlowLine:TextFlowLine = textController.flowComposer.findLineAtPosition(i);
            var textLine:TextLine = textFlowLine.getTextLine();
            trace('number of atoms in this line: ' + textline.atomCount);
            for (var j:int=0; j<=textLine.atomCount; j++) {
                try {
                    trace(textLine.getAtomBounds(j));
                } catch (e:Error) {
                    trace('error');
                }
            }
        }
    }

This returns an error that's why i have try and cache, i have tried to change textLine.atomCount to -1 but that wont work either. Now i don't know what character exactly that i have the position for. Lots of figuring out yet...

Upvotes: 0

Views: 972

Answers (1)

Constantiner
Constantiner

Reputation: 14221

You can use some of these steps which (among other things) allow to determine character's bounds.

What about your second question you can refer to the following documentation and/or some samples.

Upvotes: 1

Related Questions