    package com.bluefire.flexDemo.view
    {

        import mx.containers.dividedBoxClasses.BoxDivider;
        import flash.events.MouseEvent;
        import mx.containers.DividedBox;
        import mx.containers.BoxDirection;
        import mx.containers.DividerState;
        import flash.display.DisplayObject;
        import mx.core.mx_internal;
        import flash.display.Graphics;
        import mx.core.BitmapAsset;
        import mx.controls.Image;

        use namespace mx_internal;

          public class BluBoxDivider extends BoxDivider
          {
            private var previousHeight:Number = 0;
            private var previousWidth:Number = 0;
            public var knob:BitmapAsset;
            private var g : Graphics = graphics;
            public var isOpen:Boolean = true;

            [Bindable]
            [Embed(source="/assets/boxDivider.png")]
            public var imgCls:Class;

            public function BluBoxDivider()
            {
            }

            public function flipKnob(toClose:Boolean):void
            {
                isOpen = !toClose;
                super.validateDisplayList();
            }

            override protected function updateDisplayList(unscaledWidth:Number,
                                    unscaledHeight:Number):void
            {
              if (!parent.parent["dividerEnabled"])
              {
                if (knob)
                {
                  removeChild(knob);
                  knob = null;
                }
                graphics.clear();
              }
              else
              {
                if (isNaN(width) || isNaN(height))
                  return;

                if (!parent)
                  return;

                var color:Number;
                var alpha:Number = 1.0;

                var thickness:Number = getStyle("dividerThickness");

                var isVertical:Boolean = DividedBox(owner).direction != BoxDirection.HORIZONTAL;

                var gap:Number = isVertical ?
                       DividedBox(owner).getStyle("verticalGap") :
                       DividedBox(owner).getStyle("horizontalGap");

                if (state != DividerState.DOWN)
                {
                  // Draw knob, if there is enough room
                  if (gap >= 6)
                  {

                    if (!knob)
                    {
                    //add the knob as a bitmap
                    knob = new imgCls() as BitmapAsset;
                      if (knob)
                        addChild(knob);
                    }

                    if (knob)
                    {
                      if (isOpen)
                      {
                        knob.scaleX = 1.0;
                        knob.x = Math.round((width - knob.width) / 2);
                      }
                      else
                      {
                        // Rotate the knob
                        knob.scaleX = -1.0;
                        knob.x = Math.round(width);
                      }

                      knob.y = Math.round((height - knob.height) / 2);
                    }

                  }
                  return;
                }

                color = getStyle("dividerColor");
                alpha = getStyle("dividerAlpha");
                graphics.beginFill(color, alpha);

                if (isVertical)
                {
                  var visibleHeight:Number = thickness;

                  if (visibleHeight > gap)
                    visibleHeight = gap;

                  var y:Number = (height - visibleHeight) / 2;
                  graphics.drawRect(0, y, width, visibleHeight);
                }
                else
                {
                  var visibleWidth:Number = thickness;

                  if (visibleWidth > gap)
                    visibleWidth = gap;

                  var x:Number = (width - visibleWidth) / 2;
                  graphics.drawRect(x, 0, visibleWidth, height);
                }

                graphics.endFill();
              }
            }

            override public function styleChanged(styleProp:String):void
            {
              super.styleChanged(styleProp);

              if (!styleProp ||
                styleProp == "dividerSkin" ||
                styleProp == "styleName")
              {
                if (knob)
                {
                  removeChild(knob);
                  knob = null;
                }
              }
            }
          }
    }