Copy link to clipboard
Copied
I have dynamic text boxes next to each other, each showing a letter and creating a word, any letter of English ABC. Since some letters are wider, how could I get the width of each letter to figure out spacing between them?
Thanks!!
You can use the textWidth property of the textfield to get the width of the text inside it.
Copy link to clipboard
Copied
You can use the textWidth property of the textfield to get the width of the text inside it.
Copy link to clipboard
Copied
Thanks! Works prefectly!!
Copy link to clipboard
Copied
You're welcome
Copy link to clipboard
Copied
I must add I got the textWidth work, came up with a simple formula to place the letters at an even distance, but still, some letters like capital W and P need less space after them to look nice. The second letter can be closer to them. No big deal, can be solved with an if statement, leave less space in case those letters are capitalized.
Copy link to clipboard
Copied
Yep, some letters are not evenlt spread across their width, especially so with variable width fonts. If you were to use a fixed width font you, like Courier, you would probably not have as much of an issue.
Copy link to clipboard
Copied
Thanks for the info Ned, very useful as always.
My little Flash project is going to be used by children, this is why I've been using Comic Sans. This is one of the few fonts that uses single-story letter "a".
Find more inspiration, events, and resources on the new Adobe Community
Explore Now