Get global x y of characters in TextLines
Hi,
I'm hoping you can help me. I am trying to get the global coordinates of very character in a RichEditableText (which uses TLF).
I'm working with TLF and going through each textline in a flow composer trying to get the exact start x& y of every character based on atom position. The code below is what I have so far. Suffice to say the multiple columns are being ignored (each line appears one after the other rather than to the right of the previous colum after reaching the bottom).
Also - the character placement starts out OK but the atom coordinates seem to go out of sync with the characters after a few words - too close or far from its character neighbours - and new lines seem to be ignored.
I'd greatly appreciate any help with this.
var
text:String = richEditableText.getTextFlow().getText();for
(var i:int =0; i < richEditableText.getTextFlow().flowComposer.numLines; i++){
var flowLine:TextFlowLine = te.getTextFlow().flowComposer.findLineAtPosition(i);
var textLine:TextLine = flowLine.getTextLine(true);
var
currentChar:int = 0;
var rawCount:int = textLine.rawTextLength;
for (var j:int =0; j < textLine.rawTextLength; j++){
var x:int = textLine.getAtomBounds(j).x + richEditableText.x;
var y:int = textLine.getAtomBounds(j).y + (textLine.height *i)+ richEditableText.y;
trace(text.charAt(currentChar)+", "+x+", "+y+", "+textLine.getAtomIndexAtCharIndex(j));
currentChar++;
}
// end j
}}
// end i
}}
// end i
}}
// end i
