Skip to main content
Inspiring
Feb 28, 2010 1:32 PM UTC
Question

TLF Autosize

I want a ContainerController to autosize.  Like setting TextField.autosize, so that the textfield expands to fit all the text it holds (without scrolling or truncating the text).  How do I do this?

If I call ContainerController.setCompositionSize(...,calculateHeight()); - will that do it?  Is there a way to update this automatically? (apart from the obvious way using an event handler).

I know that FTETextField supports autosize, but I never use mx. flex classes in my own pure actionscript projects.

(What I'm doing next in e2publish is adding tables - and rows will expand to accommodate text in cells.  http://www.e2easy.co.cc/e2publish.html )

This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

casper_no
Known Participant
May 21, 2010 1:32 PM UTC

Thanks! I was having the same problem. I agree that setting composition height to NaN is a bit messy and not intuitive. containerController.autosizeHeightToContent or similar boolean setter would be clearer.

The current documentation doesn't mention the NaN option at all.

Translate
Adobe Employee
May 24, 2010 9:49 PM UTC

I will add a bug to update the documentation. Thanks!


Translate
Adobe Employee
Mar 2, 2010 6:08 AM UTC

I think you can do the same thing by calling:

textFlow.flowComposer.composeToPosition();

var contentBounds:Rectangle = controller.getContentBounds();

controller.setCompositionSize(controller.compositionWidth, contentBounds.height);

flowComposer.updateAllControllers();

Can you try that?

- robin

Translate
Participating Frequently
Mar 2, 2010 6:25 PM UTC

You can also set the compositionWidth and compositionHeight of your container controller to NaN, though that'll prevent things like text alignment from working.

Translate
Apr 13, 2010 1:48 PM UTC

Setting something to NaN can simply not be the correct way to do this Adobe!

Translate