In a previous example, “Setting the horizontal divider cursor on an HDividedBox container in Flex”, we saw how to set a horizontal divider cursor on a Flex HDividedBox container by setting the horizontalDividerCursor style.
The following example shows how you can set a vertical divider cursor on a Flex VDividedBox container by setting the verticalDividerCursor style.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/10/10/setting-the-vertical-divider-cursor-on-a-vdividedbox-container-in-flex/ -->
<mx:Application name="VDividedBox_verticalDividerCursor_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:VDividedBox id="vDividedBox"
verticalDividerCursor="@Embed('assets/arrow_refresh.png')"
width="100%"
height="100%">
<mx:HBox backgroundColor="haloGreen"
width="100%"
height="100%">
</mx:HBox>
<mx:HBox backgroundColor="haloBlue"
width="100%"
height="100%">
</mx:HBox>
</mx:VDividedBox>
</mx:Application>
View source is enabled in the following example.
You can also set the verticalDividerCursor style using an external .CSS file or <mx:Style /> block, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/10/10/setting-the-vertical-divider-cursor-on-a-vdividedbox-container-in-flex/ -->
<mx:Application name="VDividedBox_verticalDividerCursor_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Style>
VDividedBox {
verticalDividerCursor: Embed("assets/arrow_refresh.png");
}
</mx:Style>
<mx:VDividedBox id="VDividedBox"
width="100%"
height="100%">
<mx:HBox backgroundColor="haloGreen"
width="100%"
height="100%">
</mx:HBox>
<mx:HBox backgroundColor="haloBlue"
width="100%"
height="100%">
</mx:HBox>
</mx:VDividedBox>
</mx:Application>
Or, you can set the verticalDividerCursor style using ActionScript, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/10/10/setting-the-vertical-divider-cursor-on-a-vdividedbox-container-in-flex/ -->
<mx:Application name="VDividedBox_verticalDividerCursor_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
[Embed("assets/arrow_refresh.png")]
private const ArrowRefreshIcon:Class;
private function vDividedBox_init():void {
vDividedBox.setStyle("verticalDividerCursor", ArrowRefreshIcon);
}
]]>
</mx:Script>
<mx:VDividedBox id="vDividedBox"
width="100%"
height="100%"
initialize="vDividedBox_init();">
<mx:HBox backgroundColor="haloGreen"
width="100%"
height="100%">
</mx:HBox>
<mx:HBox backgroundColor="haloBlue"
width="100%"
height="100%">
</mx:HBox>
</mx:VDividedBox>
</mx:Application>
Due to popular demand, here is the “same” example in a more ActionScript friendly format:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/10/10/setting-the-vertical-divider-cursor-on-a-vdividedbox-container-in-flex/ -->
<mx:Application name="VDividedBox_verticalDividerCursor_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
initialize="init();">
<mx:Script>
<![CDATA[
import mx.containers.HBox;
import mx.containers.VDividedBox;
[Embed("assets/arrow_refresh.png")]
private const ArrowRefreshIcon:Class;
private var vDividedBox:VDividedBox;
private var hBox1:HBox;
private var hBox2:HBox;
private function init():void {
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");
vDividedBox = new VDividedBox();
vDividedBox.percentWidth = 100;
vDividedBox.percentHeight = 100;
vDividedBox.addChild(hBox1);
vDividedBox.addChild(hBox2);
vDividedBox.setStyle("verticalDividerCursor",
ArrowRefreshIcon);
addChild(vDividedBox);
}
]]>
</mx:Script>
</mx:Application>




like always, just big thx….