0 Replies Latest reply on Jun 30, 2009 5:28 AM by Chris_Hof

    Adjust fontSize of TextInput

    Chris_Hof

      Hey all,

       

      I'm  using the "changed" event of a TextInput to do the following:

       

      while ( Textfield.textWidth > Textfield.width ) {
           Textfield.setStyle( "fontSize", Textfield.getStyle( "fontSize" ) - 1 );

       

      }

       

      It should change the fontSize so the text always fits the width of the component without scrolling. But the value of textWidth doesn't change during the while condition, so the trace shows fontSize going down to -50000 and either Flash Player ends after 15 seconds or stops and the text is displayed with a height of 1 pixel. I've also tried adding a Textfield.validateNow() after the setStyle() statement, but no help.

       

      Thanks in advane for any help with this!