views:

18

answers:

1

I'd like to adjust the width of the default ScrollBar that appears inside of a Flash ComboBox. From my research on various forums, it seems like the best approach would be to subclass fl.controls.ScrollBar, which I've tried doing here:

package helpers {

  import fl.controls.ScrollBar;

  public class CustomScroller extends fl.controls.ScrollBar {

    public function CustomScroller() {
      super();
      trace("custom scroller in full effect!");
      width = 40;
    }  
  }
}

Then, in my library, I've taken the "ScrollBar" movie clip that appears upon initial creation of a ComboBox and changed the base class to "helpers.CustomScroller". I've got three ComboBox instances on the stage; however, none of them are showing anything but the default width, nor am I seeing the output from the trace() statement in my constructor.

Any idea why this isn't working? Thanks for your consideration.

+1  A: 

I have only had to do this once, and don't want to do it any more. Basically, to accomplish this, I needed to create a copy of fl.controls.ScrollBar called fl.controls.WideScrollBar. You also need to modify fl.containers.BaseScrollPane and fl.containers.ScrollPane.

In WideScrollBar I overrode public static const WIDTH:Number

In WideBaseScrollPane you need to change the class of _verticalScrollBar and/or _horizontalScrollBar to be WideScrollBar. Then in my WideScrollPane, I overrode the calls to setStyle in the contructor to point to my custom class instances for skinning.

sberry2A
Thanks! Sounds like a PITA but I don't have time to write my own classes right now. Where did you find the source for the components themselves in order to modify them?
justinbach