【发布时间】:2011-05-02 11:27:29
【问题描述】:
我想弄清楚我是否能以 anny 的方式获得文本流中每个字符的确切位置?我也遇到了 TLF 文档的问题,是否有 anny 文档显示更多关于如何使用它在 actionscript 而不是 mxml 中,我希望编写我自己的组件,如果我不需要,也许不使用richtexteditor。
非常感谢!
编辑:我终于想出了如何在文本流中获取每个字符的位置:
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');
}
}
}
}
这会返回一个错误,这就是我尝试缓存的原因,我尝试将 textLine.atomCount 更改为 -1 但这也不起作用。现在我不知道我的职位到底是什么角色。很多事情还没有弄清楚...
【问题讨论】:
标签: apache-flex