Skip to main content
Participant
Dec 8, 2010 2:25 PM UTC
Question

Determining if the amount of text exceeds the available width

Hello,

So I've created a TextFlow input field using

textFlow.interactionManager = new EditManager();

I've also limited the vertical scrolling to using controller.verticalScrollPolicy = ScrollPolicy.OFF;

so basically I have just one input line.

The controller also has a fixed width, so when a user starts typing and the amount of text exceeds the available viewing space the newly entered text is no longer visible.

What I'm after is a method to 'read' the total textWidth and compare that to the width of the textFlow container so I can do something when the space runs out. Is this at all possible?

Many thanks for any thoughts

cheers

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

3 replies

Adobe Employee
Dec 8, 2010 11:17 PM UTC

The ContainerController has a content bounds (see getContentBounds). You could check the content bounds to see how wide the text is.

Do you want the text to wrap at the container edge? If not, you could consider setting compositionWidth to NaN.

Hope this helps,

- robin

Translate
FlashertAuthor
Participant
Dec 10, 2010 9:09 AM UTC

Hi Rob

Thanks very much! I'll give it a try and post the results later

cheers

elvin

Translate