# Textfield.getTextFormat() does not return correct format for that index

**URL:** <https://forum.kirupa.com/t/textfield-gettextformat-does-not-return-correct-format-for-that-index/322311>\
**Category:** Uncategorized\
**Created:** [May 17, 2011, 7:04pm UTC](https://forum.kirupa.com/t/textfield-gettextformat-does-not-return-correct-format-for-that-index/322311 "2011-05-17T19:04:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cakepizza](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@cakepizza](https://forum.kirupa.com/u/cakepizza)\
**Post date:** [May 17, 2011, 7:04pm UTC](https://forum.kirupa.com/t/textfield-gettextformat-does-not-return-correct-format-for-that-index/322311/1 "2011-05-17T19:04:12Z")

</div>

All I have in the fla is this code

```auto

stop();
var t; var f;
var texField=getChildAt(0);

for(var i:int=0; i <= texField.text.length-1; i++)
{
t=texField.text.charAt(i);
f=texField.getTextFormat(i);
trace(t,f.color);
} //end

```

and a static text textbox on the main timeline that says

ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum  
email to [test@test.com](mailto:test@test.com) BLA BLA BLA BLA BLA

"test@test.com" is blue text, the rest is all black. The trace from my code above traces that "t@test.com BL" is the blue text;

I have noticed that the distance that getTextFormat is off from the correct index is dependant on the number of forced linefeeds due to the restricted width of the text field.

Is this a bug in flash or is there a reason for it and someway to fix it?

you can download this example fla I am using here.  
[http://www.snapdrive.net/files/531244/text\_test.fla](http://www.snapdrive.net/files/531244/text_test.fla)

thanks!
