[Flashcoders] AS3 text fitting in variable box

2008-11-12 Thread Latcho
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

Re: [Flashcoders] AS3 text fitting in variable box

2008-11-12 Thread Joel Stransky
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]

Re: [Flashcoders] AS3 text fitting in variable box

2008-11-12 Thread Latcho
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

Re: [Flashcoders] AS3 text fitting in variable box

2008-11-12 Thread jonathan howe
Is there an important distinction between scaling a TextField object and changing the font size? Perhaps you are storing the formatting or there are visual rendering implications or anything?? Otherwise, it seems like Joel's solution would work nicely to achieve what you want. -jonathan On Wed,

[Fwd: Re: [Flashcoders] AS3 text fitting in variable box]

2008-11-12 Thread Latcho
Hi Joel, Jonathan anf Dave for your answers Dave could you explain what you mean with a binary search ? Stijn David Hershberger wrote: 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

[Fwd: Re: [Flashcoders] AS3 text fitting in variable box]

2008-11-12 Thread Latcho
Joel, Jonathan and Dave: thanks for your answers Dave could you explain what you mean with a binary search ? I haven't got a clue. Stijn David Hershberger wrote: Text flow of variable-width fonts with word-wrapping is inherently messy... there's no way to compute the number of lines with

[Flashcoders] AS3 text fitting in variable box

2008-11-12 Thread David Hershberger
No problem. A binary search is an order log(N) method for finding something in an ordered list of elements, as compared to linear search, which is order N. (N is the number of elements, in this case, font sizes you are willing to use.) You have a sequence of font sizes. For each size, it either

Re: [Flashcoders] AS3 text fitting in variable box

2008-11-12 Thread Latcho
The distinction is that wordwrapping should be optimal, as you know when you increase / decrease a fontsize, the wordwrapping changes. jonathan howe wrote: Is there an important distinction between scaling a TextField object and changing the font size? Perhaps you are storing the formatting or

Re: [Flashcoders] AS3 text fitting in variable box

2008-11-12 Thread David Hershberger
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