Experimental VDividedBox. Reference #1137
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/VDividedBox.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/VDividedBox.as
index 5620de8..f903016 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/VDividedBox.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/VDividedBox.as
@@ -76,6 +76,7 @@
//
//--------------------------------------------------------------------------
+ import org.apache.royale.events.MouseEvent;
/**
* Constructor.
*
@@ -88,8 +89,37 @@
{
super();
typeNames = "VDividedBox";
+ super.direction = "vertical";
+ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
}
+ protected function mouseDownHandler(event:MouseEvent):void
+ {
+ if (event.target != this)
+ {
+ return;
+ }
+ addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
+ topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ }
+
+ protected function mouseUpHandler(event:MouseEvent):void
+ {
+ removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
+ topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ }
+
+ protected function mouseMoveHandler(event:MouseEvent):void
+ {
+ var h1:int = Math.floor(100 * event.localY / height);
+ h1 = Math.min(h1, 95);
+ h1 = Math.max(h1, 5);
+ getChildAt(0).percentHeight = h1;
+ getChildAt(1).percentHeight = 100 - h1;
+ _layout.layout();
+ }
+
+
//--------------------------------------------------------------------------
//
// Overridden properties