Skip to main content
Participant
May 27, 2010 10:17 AM UTC
Answered

get Bounds of a textline in TF

Hey guys!

i have a textflow ( width:500 , height:200 ) within a longer text

     the text in the textflow breaked to 3 lines ( multiline with break ) ...

     i want to know how to get the following values:

          - the Width & Height of 1st line in pixel and x , y ( bounds of the  first line )

          - the Width & Height of 3rd line in pixel and x , y ( bounds of the third line )

     ...and

          - is it possible in a textflow to set the CompositionSize to Auto ( AutoWidth / AutoHeight ) according to the contained text ?

Thanks!

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer
May 27, 2010 5:34 PM UTC

For your first question:

From your TextFlow, you can use its flowCompser to get at the individual TextFlowLines. The TextFlowLine has a getBounds() method:

textFlow.flowComposer.getLineAt(0).getBounds() // returns a Rectangle for line 1

textFlow.flowComposer.getLineAt(2).getBounds() // returns a Rectangle for line 3

3 replies

Correct answer
May 27, 2010 5:34 PM UTC

For your first question:

From your TextFlow, you can use its flowCompser to get at the individual TextFlowLines. The TextFlowLine has a getBounds() method:

textFlow.flowComposer.getLineAt(0).getBounds() // returns a Rectangle for line 1

textFlow.flowComposer.getLineAt(2).getBounds() // returns a Rectangle for line 3

Translate
May 27, 2010 5:39 PM UTC

On your second question you can set the compositionHeight and compositionWidth of your ContainerController to NaN in order to have the text contents determine the size of the container. There is some discussion of this in this forum post: http://forums.adobe.com/message/2732094#2732094

Translate
rCANE_Author
Participant
May 27, 2010 5:50 PM UTC

Thanks Alan!

That's great!

Translate