kuza55/minimalcomps

ScrollPane bars follow content & content scrolling logic appears to be reversed

Closed this issue · 3 comments

Using this snippet in an air app on r152:
            var sp:ScrollPane = new ScrollPane(this, 0, 0);
            sp.setSize(400, 400);
            var garbage:Array = [1, 2, 3, 4];
            var bc:BarChart = new BarChart(sp, 16, 16, garbage);
            bc.setSize(128, 128);
            sp.update();

Results in the scroll bars following the content when it scrolls, only if the 
content is smaller than the pane size. If the content is larger than the pane, 
then scrolling doesn't work at all.

The content doesn't seem to change the results; the bar chart was just an easy 
repro.

Original issue reported on code.google.com by krysmopo...@gmail.com on 9 Feb 2011 at 6:25

The "Panel and Window Content" section of tips and tricks says to add to the 
content member of the Panel, which also doesn't affect the result in this case 
either; nor does adding the ScrollPane itself as a child of another panel 
instead of the app's MovieClip.

Original comment by krysmopo...@gmail.com on 9 Feb 2011 at 6:33

Thanks. Problem was that the scrollbars and corner shape were being added using 
addChild which now added them to the content. Should work now. Note, if you 
resize the chart (or whatever) you may have to call draw() on it to make sure 
it updates before calling update on the scrollpane.


var sp:ScrollPane = new ScrollPane(this, 0, 0);
sp.setSize(400, 400);
var garbage:Array = [1, 2, 3, 4];
var bc:BarChart = new BarChart(sp, 16, 16, garbage);
bc.setSize(700, 128);
bc.draw();
sp.update();

Original comment by k...@bit-101.com on 9 Feb 2011 at 12:25

  • Changed state: Fixed
Thanks for the quick fix; everything is behaving as expected now.

Original comment by krysmopo...@gmail.com on 9 Feb 2011 at 10:27