explicitMinHeight
of 10, but the way to change that is not very straightforward. Here's the easiest solution I found:import mx.controls.VScrollBar;
import mx.core.mx_internal;
public class MyVScrollBar extends mx.controls.VScrollBar
{
public function MyVScrollBar()
{
super();
}
public override function set pageSize( value:Number ):void {
super.pageSize = value;
updateThumbHeight();
}
[...]
public override function setScrollProperties(
pageSize:Number,
minScrollPosition:Number,
maxScrollPosition:Number,
pageScrollSize:Number = 0
):void {
super.setScrollProperties(
pageSize,
minScrollPosition,
maxScrollPosition,
pageScrollSize
);
updateThumbHeight();
}
private function updateThumbHeight():void {
if ( mx_internal::scrollThumb ) {
mx_internal::scrollThumb.explicitMinHeight = 40;
}
}
}
mx_internal
namespace to access its scrollThumb
property, which is an instance of ScrollThumb class. Now it's just a matter of setting explicitMinHeight
whenever one of the scroll properties is changed. I only show pageSize
, but the other properties in setScrollProperties()
should also be overridden.Math.max()
to prevent the thumb from getting too tiny (again), we're set! Change the last function to this: private function updateThumbHeight():void {
if ( mx_internal::scrollThumb ) {
mx_internal::scrollThumb.explicitMinHeight =
Math.max( height - maxScrollPosition, 40 );
}
}
explicitMinHeight
does a lot of work for us, adjusting the rest of the scroll properties as necessary. Other height-related properties do not work as well. mx_internal
, it's actually a member modifier, like private
or public
. All the properties you see in the Flex debugger with a yellow rhombus are mx_internal
properties. For a more in-depth look, check out When and how to use mx_internal in Flex at Code Of Doom.Etiquetas: actionscript, howto