Text flow of variable-width fonts with word-wrapping is inherently messy...
there's no way to compute the number of lines with some nice math, you just
have to run the text-flow machinery and measure the result, which is exactly
what you have suggested.  I'm pretty certain there is nothing built into
flash or flex to choose a font size for you automatically.

My only suggestion is a speed optimization: use a binary search instead of
trying every font size.

Dave

On 11/12/08, Latcho <[EMAIL PROTECTED]> wrote:
>
>
> I'm talking about font size, not stretching a container.
> Increasing / decreasing font size to get an optimal fill of a box which
> will have a fixed width and a certain height which can only be determined
> during load time.
> I could increase the font size of a textfield in a loop and measure it's
> height on every point increase; when it overflows my wanted box-height I
> take the font size of the  previous step.
> Is there an easier way ?
> Stijn
>
> Joel Stransky wrote:
>
>> Sounds like a bad design decision to make titles of the same category
>> various sizes. But I think you can just set the .width property, then set
>> the .scaleY equal to the .scaleX or visa versa depending on which dimension
>> is more important.
>>
>> On Wed, Nov 12, 2008 at 9:40 AM, Latcho <[EMAIL PROTECTED] <mailto:
>> [EMAIL PROTECTED]>> wrote:
>>
>>    I need to place project-titles in a multiline textfield, wherof
>>    the width will be fixed, but sometimes this box might be of less
>>    height because of more space used by other displaying project
>>    elements.
>>    Is there a class that can dynamically regulate the font it's size
>>    to fit the loaded text to a certian textfield height of a multile
>>    textfield?
>>    The project titles are variable in character word length. How is
>>    this solvable.
>>    Thanks !
>>    Stijn
>>
>>    _______________________________________________
>>    Flashcoders mailing list
>>    [email protected]
>>    <mailto:[email protected]>
>>    http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>
>>
>>
>> --
>> --Joel
>>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to