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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -