tags:

views:

756

answers:

2

I have a TileList in flex, and need to be able to detect if the scroll bars are shown or not, so I can change the size of the items it is laying out.

ScrollPolicy is set to auto, but I need a variable like CurrentScrollPolicy which will change from off to on depending on the content.

Thanks

+1  A: 

You need to check the verticalScrollBar. If its null then there is no scrollbar. If it is not null then there is a scrollbar.

kenneth
A: 

Thanks eBuildy, your right!

I have created an example that also takes into account the fact that scroll bars get hidden when not needed rather than set back to null:

   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.

robmcm