This content has been marked as final. Show 4 replies
have you looked into "TextField.autoSize" ?
> I wonder if there is a way to easily calculate how wide to make a textfield
> that you create dynamically with createTextField based on the length of a
> string that is passed as an argument. In other words, if you know the font
> size you plan on using, is there a way to figure out how many pixels you need?
> Thanks in advance to anyone who can offer some assistance.
How i createTextField setting width based on string length?
Here's a sample for you.
var myText_txt = myClip_mc.createTextField("myText_txt",1,0,0,0,0); //instance name, depth,x,y,w,h
myText_txt.autoSize = true;//this takes care of setting the w,h correctly depending on the string assigned in the next statement
myText_txt.text = "Big long string of text";