The following example shows you how to position controls on the display list using the <mx:ConstraintColumns /> and <mx:ConstraintColumn /> tags.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/10/02/positioning-controls-in-flex-3-using-constraint-columns/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:ApplicationControlBar dock="true">
<mx:Form>
<mx:FormItem label="col1 width:">
<mx:HSlider id="slider1"
minimum="50"
maximum="250"
value="200"
liveDragging="true"
snapInterval="1"
tickInterval="20"
dataTipPrecision="0" />
</mx:FormItem>
<mx:FormItem label="col2 width:">
<mx:HSlider id="slider2"
minimum="50"
maximum="250"
value="200"
liveDragging="true"
snapInterval="1"
tickInterval="20"
dataTipPrecision="0" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:Canvas width="100%">
<mx:constraintColumns>
<mx:ConstraintColumn id="col1" width="{slider1.value}" />
<mx:ConstraintColumn id="col2" width="{slider2.value}" />
</mx:constraintColumns>
<mx:Button label="OK" left="col1:0" right="col1:0" />
<mx:Button label="Cancel" left="col2:0" right="col2:0"/>
</mx:Canvas>
</mx:Application>
View source is enabled in the following example.
For more information on enhanced constraints in Flex 3, see “Flex 3 Details - Enhanced Constraints”.




Great Article , however I’m having trouble with the stability of FlexBuilder3 B2 when using constraintRows/constraintColumns , have you tried adding more rows ? Once you get to
approx 10 rows , FB3 will crash alot , the swf that is generatored runs really slowly also , eating cpu / memory .
Ian Ilsley,
This is probably one of the first times I’ve played with the new constraint rows and columns in Flex Builder 3. If you have a simple, reproducable test case, would you mind filing it in the public Flex Bugbase at http://bugs.adobe.com/flex/ and somebody at Adobe can investigate. (Also, post the bug number here if you don’t mind and I can try and push it through the queue a bit faster. Thanks.)
Peter
Hi Peter ,
I’ve already logged a bug
http://bugs.adobe.com/jira/browse/FB-9904
thanks
Ian