<?xml version="1.0" encoding="utf-8"?>
<mx:Application name="HDividedBox_getDividerAt_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
initialize="init();">
<mx:Script>
<![CDATA[
import mx.containers.ApplicationControlBar;
import mx.controls.ButtonLabelPlacement;
import mx.containers.HBox;
import mx.containers.HDividedBox;
import mx.controls.CheckBox;
private var checkBox:CheckBox;
private var hBox1:HBox;
private var hBox2:HBox;
private var hBox3:HBox;
private var hDividedBox:HDividedBox;
private function init():void {
checkBox = new CheckBox();
checkBox.label = "Disable dividers:";
checkBox.labelPlacement = ButtonLabelPlacement.LEFT;
checkBox.addEventListener(Event.CHANGE,
checkBox_change);
var appControlBar:ApplicationControlBar;
appControlBar = new ApplicationControlBar();
appControlBar.dock = true;
appControlBar.addChild(checkBox);
addChildAt(appControlBar, 0);
hBox1 = new HBox();
hBox1.percentWidth = 100;
hBox1.percentHeight = 100;
hBox1.setStyle("backgroundColor", "haloGreen");
hBox2 = new HBox();
hBox2.percentWidth = 100;
hBox2.percentHeight = 100;
hBox2.setStyle("backgroundColor", "haloBlue");
hBox3 = new HBox();
hBox3.percentWidth = 100;
hBox3.percentHeight = 100;
hBox3.setStyle("backgroundColor", "haloOrange");
hDividedBox = new HDividedBox();
hDividedBox.percentWidth = 100;
hDividedBox.percentHeight = 100;
hDividedBox.addChild(hBox1);
hDividedBox.addChild(hBox2);
hDividedBox.addChild(hBox3);
addChild(hDividedBox);
}
private function checkBox_change(evt:Event):void {
var value:Boolean = !checkBox.selected;
var idx:uint;
var len:uint = hDividedBox.numDividers;
for (idx = 0; idx < len; idx++) {
hDividedBox.getDividerAt(idx).visible = value;
}
}
]]>
</mx:Script>
</mx:Application>