Idea:

for target width tw:

 1. Guess a font-size:
 2. Create a label, set text and font, call validateNow();
 3. Label.measuredWidth < tw ? goto 1
 4. label.scaleX = tw / label.width

-Josh

On Thu, Oct 9, 2008 at 4:55 AM, Richard Rodseth <[EMAIL PROTECTED]> wrote:

>  I have a requirement to display some text overlaid on some graphics. The
> catch is that the whole thing must render at different sizes and the length
> of the text is variable (data driven). And of course, the aspect ratio of
> the graphic should be preserved.
>
> I've dabbled with Degrafa. I've fiddled with font size computed dynamically
> in a binding expression. I've mucked with measureText(). I even took a stab
> at a custom component I sent to the list earlier, that tries to scale any
> child to fit, preserving aspect ratio and centering as required. But the
> variable length of the text really means that I can't have a "reference
> size" for the whole composition unless I scale or size the text to fit in a
> certain area.
>
> Can anyone point me at some useful examples or components. Even just an
> example of a label whose font size changes as its text does, and when its
> container is resized.
>
> Thanks.
> 
>



-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

http://flex.joshmcdonald.info/

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to