I know you can do this with a list, but is there any way to tell a scroller to make sure an element is visible? I'm wanting to make sure that form fields that failed validation are visible...
The layout for the Scroller's viewport should have a method called getScrollPositionDeltaToElement(index) that returns a Point object for the necessary scroll positions. Then manually set the horizontal and vertical scroll for the viewport based on the returned Point object. See the ensureIndexIsVisible() method in the spark List class.
However, I have never had much luck with this method. If all else fails, get the x/y coordinates of the element (the one that needs to be visible), in the viewport's coordinate system, and use this data, along with the viewport's scroll positions and height, to manually make sure the element is visible.
Awesome- your second approach works great. Thanks!
Great, glad I could help.