3 Replies Latest reply on Nov 19, 2008 9:03 PM by Devendran

    Dynamic font-size

    samisthesound
      I have a dynamic text field that is populated by an XML string that is constantly updated. I want the text that appears in the text box to fill the stage, i.e. if the text is very short, the font should be very large, and if the text is long, the font should be small so that it always fits.

      how is this done?
        • 1. Re: Dynamic font-size
          Devendran Level 1
          For this you need to adjust the Font size and have to compare it with Stage Size. So better to scale your Text with aspect ratio to fit in to Screen size.

          • 2. Re: Dynamic font-size
            samisthesound Level 1
            I'm sorry, you are being very vague. Could you be more descriptive of what you mean for me to accomplish?
            • 3. Re: Dynamic font-size
              Devendran Level 1
              You Need to write a Recursive Code to increase the font size and to compare it with the Size you are expecting.
              i.e, After incresing the font size you need to check the Size, Then again you need to increase the size and have to check it. Like wise untill you reached the Exact Font size.

              In another way Just put your Text inside a MovieClip and Scale that Clip to fit. For example. If the width is greater than height Scale the width to fit on to stage, then Get the Scale percentage of (_xscale) and apply the same scale value to Height (_yscale). You have to improve the logic to fit for all the Sizes