2011-05-02 36 views
0

我想弄清楚我是否可以以anny的方式獲得textflow中每個字符的確切位置?我也遇到了TLF文檔的問題嗎?是否有anny文檔顯示更多關於如何在actionscript而不是mxml中使用它,即時通訊尋找編寫我自己的組件,並且如果我不需要,可能不會使用richtexteditor。在TLF中獲取字符位置

非常感謝!

編輯:我終於覺得我想通了,如何讓每個字符位置在文本流:

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​​,但不會工作。現在我不知道我的位置是什麼。很多搞清楚......

回答

1

你可以使用一些these steps哪些(除其他外)允許確定字符的界限。

那麼你的第二個問題你可以參考the following documentation和/或some samples

+0

鏈接到的示例適用於Flash CS5,使用Flash Builder的TLFTextField類不適用於我。這個TLF的東西很混亂。感謝其他鏈接,我仍然在閱讀並從中解讀出他們的東西。 – eldamar 2011-05-03 06:53:03