You can get the text's width with textfield.textWidth.
Hopefully, inside the mcs, your textfield has an instance name (i don't see where/how you add text in that code sample). If not, you can do so from the properties panel.


gparis