Skip to main content
November 11, 2009
Question

getLineMetrics getLineOffset not working in spark?

  • November 11, 2009
  • 1 reply
  • 1019 views

just wondering if there is an update my team and I might have missed or if there is a work around for getting this information in Flex 4 spark components?

-erik

This topic has been closed for replies.

1 reply

Participant
November 11, 2009

If you are looking for the line metrics of the textFlow, you can get it like so:

container.addEventListener(MouseEvent.CLICK, getLineRect);

function getLineRect(event:MouseEvent)

{

var textLine:TextLine = event.target as TextLine;

if (textLine)

{

    var rx:int = TextFlowLine(textLine.userData).getBounds().x;

    var ry:int = TextFlowLine(textLine.userData).getBounds().y;

    var rw:int = TextFlowLine(textLine.userData).getBounds().width;

    var rh:int = TextFlowLine(textLine.userData).getBounds().height;

}

But if you are looking for something similar to getCharBoundaries to find the characterBoundaries then the closest available in TLF is:

http://help.adobe.com/en_US/Flex/4.0/langref/flash/text/engine/TextLine.html

you can also refer these:

http://forums.adobe.com/thread/465606

http://forums.adobe.com/thread/453085

In essence it doesn't look like there is a straight forward way of doing it

- KP