0

Is there an easy way to set the backgroundColor of a HDividedBox's (or VDividedBox's) BoxDivider object(s)? A BoxDivider is the "divider" that has the drag handle on it.

By default, the BoxDivider is transparent with the little handle image on it.

There is a dividerSkin style that defaults to mx.skin.BoxDividerSkin which is a reference to a symbol in the Assets.swf file.

Any ideas? Do I have to make an alternate skin? Is that my only option? Googling this led me to many solutions that were weird and hacky and frankly didn't seem to work.

Thanks.

3 Answers 3

3

OK, here's how you do this:

  1. create a class that extends ProgrammaticSkin
  2. override updatedisplaylist method like this:
override protected function updateDisplayList(w:Number, h:Number):void
{
    var divwidth:Number = getStyle("dividerThickness");

    if (divwidth == 0)
    {
        divwidth = 10;
    }

    graphics.clear();
    graphics.beginFill(0xFF0000, 1.0);
    graphics.drawRect(-(parent.height / 2), -(divwidth / 2), parent.height, divwidth);
    graphics.endFill();

}

then add this to your hdivided box

<mx:HDividedBox dividerSkin="path.MyDividerSkin"/>

by default, the skin gets added to the middle of the divider so you need to offset the x & y...

1
  • Awesome!, the documentation makes it seem like an easy style change, but when you set the styles it doesn't work. Good job on figuring this out. Mar 11, 2010 at 19:06
1

Also, you could extend DividedBox and override the updateDisplayList to something like this:

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

        super.updateDisplayList(w,h);

        graphics.clear();
        var n:int = numDividers;
        graphics.beginFill(0xFF0000, 1.0);
        for (var i:int = 0; i < n; i++) 
        {
            var box:BoxDivider = getDividerAt(i); 
            graphics.drawRect(box.x, box.y, box.width, box.height);
        }
        graphics.endFill();

    }
0

I'd love to be able to create a simple programmatic skin for each dividedbox. so i can just do this:

<mx:HDividedBox dividerSkin="path.MyDividerSkin"

but I'm having difficulty figuring out what the MyDividerSkin class should look like. You think this would be easy. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.