Detecting if UIComponent has active scrollbars
4 answers
Thanks eBuildy, your right!
I created an example that also takes into account the fact that scrollbars are hidden when not needed, rather than revert to zero:
public class CustomTileList extends TileList
{
public function CustomTileList()
{
super();
}
/**
* Returns true if the vertical scroll bar is displayed
* @return Boolean
*
*/
public function hasVerticalScrollBar():Boolean
{
if (super.verticalScrollBar == null || super.verticalScrollBar.visible == false)
return false;
return true;
}
}
Thanks for the help.
+5
a source to share
I used a very simple trick to get around this problem. Set the scroll position to the maximum, as it will always be zero, if there is no scroll, if you are checking it and it is above zero, add the height to the element because there should be scrollbars.
yourControl.verticalScrollPosition = yourConrol.maxVerticalScrollPosition;
for (var i:int=0; i <= yourControl.verticalScrollPosition ;i++)
{
yourControl.height = yourControl.height+16;
}
+1
a source to share