Sunday, December 14, 2008

Add scrollbar to the left corner of VBox

Just a quick tip:

Many of us including me are trying to adding scrollbars in the left side of the containers instead of the right side:

Here is a solution, may be you have already found it somewhere.

1. Create a custome component extending it to VBox.
2. override its updateDisplayList method in the following way:

protected override function updateDisplayList( w:Number, h:Number ):void
{
super.updateDisplayList( w, h );

if( verticalScrollBar && verticalScrollBar.visible )
{
verticalScrollBar.scrollRect = new Rectangle(w,0,-w,h);
}
}

3. You are done ;)

No comments: