Skip to main content
Participant
May 27, 2010
Answered

get Bounds of a textline in TF

  • May 27, 2010
  • 1 reply
  • 708 views

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

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

1 reply

Correct answer
May 27, 2010

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

May 27, 2010

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

rCANE_Author
Participant
May 27, 2010

Thanks Alan!

That's great!