flash - ActionScript - textfield that shrinks font size -
how can create in actionscript singleline textfield automatically shrinks textsize whatever string shall displayed fits within size of textfield?
thanks!
i'd create function tries various font sizes until textfield has required width. this:
public function shrink(textfield, requiredwidth) { textfield.autosize = "left" var tf:* = textfield.gettextformat(); tf.size = 50; textfield.settextformat(tf); while (textfield.width > requiredwidth) { tf.size--; textfield.settextformat(tf); } }
Comments
Post a Comment