Ok, so I need to truncate my text to a width, not an amount of characters. I have a working method, but it’s too slow. After text is truncated I want to append three dots ("…") to it.
For this I have up to 16 movie clips with up to 3 fields in each that need truncating. So as you can see 3 x 16 = 48 * # of excess characters; Potentially VERY slow.
My current code is:
mc.displaySongT.text = mc.song;
altered = false;
while (mc.displaySongT.textWidth>82) {
mc.displaySongT.text = mc.displaySongT.text.slice(0, mc.displaySongT.text.length-1);
altered = true;
}
mc.displaySongT.text = mc.displaySongT.text+(altered ? "..." : "");
I could probably come up with another method myself, but I don’t really have the time.
Any help appreciated.
Nathan.