Skip to main content
Inspiring
February 28, 2010
Question

TLF Autosize

  • February 28, 2010
  • 2 replies
  • 3355 views

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 has been closed for replies.

2 replies

casper_no
Known Participant
May 21, 2010

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.

Adobe Employee
May 24, 2010

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


Adobe Employee
March 2, 2010

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

Participating Frequently
March 2, 2010

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

April 13, 2010

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