I think you meant verticalGap. It's a VDividedBox. But no, that doesn't work. You can see for yourself here: mx:VDividedBox label= width=100% height=100% verticalGap=0
mx:Panel label=panel1 width=100%/ mx:Panel label=panel2 width=100% visible=false/ /mx:VDividedBox
I remembered that I had actually ran into this problem in the past and eventually created my own class to fix it. Here it is for those interested. It involves creating your own class of divider that knows to shut itself off. It's kind of kludgy, but works for me:
VDividedBoxExt.as:package nes
{ import mx.containers.VDividedBox; import mx.containers.dividedBoxClasses.BoxDivider
; import nes.BoxDividerExt;
public class VDividedBoxExt extends VDividedBox {
private var _dividerEnabled:Boolean = true; public function VDividedBoxExt()
{ super();
dividerClass = nes.BoxDividerExt; }
public function set dividerEnabled(value:Boolean):void
{ _dividerEnabled = value; invalidateDisplayList();
} public function get dividerEnabled():Boolean
{ return(_dividerEnabled);
} }
}BoxDividerExt.as:
package nes{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;use namespace mx_internal; public class BoxDividerExt extends BoxDivider { private var previousHeight:Number = 0; private var previousWidth:Number = 0;
private var knob:DisplayObject; public function BoxDividerExt() { } 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; graphics.clear(); graphics.beginFill(0x00, 0);
graphics.drawRect(0, 0, width, height); graphics.endFill(); 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) { var knobClass:Class = Class(getStyle(dividerSkin)); if (knobClass) knob = new knobClass(); if (knob)
addChild(knob); } if (knob) { if (isVertical) { knob.scaleX = 1.0; knob.rotation
= 0; } else { // Rotate the knob knob.scaleX = -1.0; knob.rotation = -90; }
knob.x = Math.round((width - knob.width) / 2); 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; } } } }}
On 11/7/06, KP [EMAIL PROTECTED] wrote:
Try using horizontalGap("0")
- style property it should work.. J
Thanks
Kumar
From:
flexcoders@yahoogroups.com [mailto:
flexcoders@yahoogroups.com] On Behalf Of Pan Troglodytes
Sent: Tuesday, November 07, 2006
1:13 AM
To: flexcoders
Subject: [flexcoders] any way to
make VDividedBox remove splitter on child being hidden?
Is there
any way to make a VDividedBox hide the splitter control when there is only one
child visible? I have a splitter than splits two sections. But the
second section isn't always visible. However, the VDividedBox insists on
always showing the splitter and letting the user drag it around.
I would rather not have to kludge around it by pulling the second child in and
out of the VDB.
--
Jason
-- Jason
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Software development tool
Software development
Software development services
Home design software
Software development company
Your email settings: Individual Email|Traditional