Preserving position of highlighted text lines during scrolling
I'm building an editor and I want to highlight lines that are selected by mouse click. I cannot use background color since I want to highlight the whole line from one end of the container to the other. This is straightforward to implement using the x-y coordinates from the mouse event to locate the line, and then draw a highlight box as a sprite on top of the container. Thanks for the ParagraphBorder sample that helped me figure out how to get this done right away.
However, when the user scrolls via mousewheel or vertical scrollbar, the highlight box must be redrawn. I thought this would be easy by storing the current highlighted line index and accessing the textflowline by index within the corresponding event handler to redraw the box using the bounds of this line. Yet, even after updating all controllers, I seem to retrieve the wrong line by index since the box drawn using the bounds of this line is incorrect.
As another approach, I thought I could use the mousewheel delta and shift the horizontal box sprite accordingly, but this doesn't work either. The box ends up jumping all around the container - it seems like the values returned by the mousewheel are erratic. Plus the box also ends up in positions that are not properly aligned with the text lines.
Any suggestions?
I am using the latest stable build (4.0.0.13875) for Adobe Flex Gumbo.
Thanks for your time and help.
P.S. I understand that there some bugs related to mousewheel behavior. So if necessary, is it possible to disable scrolling of the textflow due to mousewheel?
