1

i am building a AS3-Class extending SkinnableContainer. Vertical scrolling only.

public class Part extends SkinnableContainer {

    public function Part() {

        var scroller : Scroller = new Scroller();
        scroller.percentHeight = 100;
        addElement(scroller);

        var content : VGroup  = new VGroup();
        scroller.viewport = content;
        fillContent();
    }

    protected function fillContent():void {...}
}

Several instances of them are placed in a HGroup, everytime

  • the height of the HGroup or
  • the content in one of the instances

changes, the widths of the instances vary because some of them get a ScrollBar depending on their height.

How can i preserve the space which will be needed for a forthcoming ScrollBar?

scroller.measuredSizeIncludesScrollBars=true 

does not lead to success.

Thank you for any hint.

zero323
  • 322,348
  • 103
  • 959
  • 935

1 Answers1

0

My understanding is that you want there to always be a scrollbars width of space to the right of each component, so that your scrollbars will just slot in without causing repositioning, correct? If that is wrong you can stop reading now!

You should be able to achieve this by setting the verticalScrollPolicy style to ON (default is AUTO):

    scroller.setStyle("verticalScrollPolicy", ScrollPolicy.ON);

This will mean that scrollbars are always visible, but when scrolling isn't possible they are disabled. If you need to hide disabled scrollbars you may need to reskin them or something similar.

Hope that helps!

Jamie Humphries
  • 3,368
  • 2
  • 18
  • 21