Getting character index of last visible character?

Hey all,

Is there any way to obtain the actual character index of the last visible character? In short, I have a teletype effect that I want to have call a function every time it reaches an invisible link tag. So something like:

if(textbox.maxVisibleCharacters >= textbox.textInfo.linkInfo[linkIndex].linkIdFirstCharacterIndex - 1) {
    ...
}

Of course this doesn’t take invisible characters into account, so I would need either the max visible character’s real index, or the link info’s visible equivalent.

Any help would be much appreciated!

EDIT: Solved for now by just keeping track of all tags and their lengths, but would still love a proper solution for this for future reference :slight_smile:

Last visible character of the text or link or each lines?

Of the text as a whole.

You should be able to use textInfo.lineCount to get the last line. Then last visible character index of that line and lastly, lookup that character in the characterInfo.