I have custom component HSlider that I'm using in a Datagrid. The
only way I can get the HSlider to show up in the datagrid is to use a
VBox as the base class of the component. I'm not sure if that bit of
info relates to my question.
How do I get the value of the slider in my data grid to reflect the
value in the "amount" field in my ArrayCollection called "layer"?
Thanks for any help in this area.
Greg
var layers:ArrayCollection = new ArrayCollection();
var myObj1:Object = new Object();
var myObj2:Object = new Object();
private function init():void
{
myObj1.name = "Layer 1";
myObj1.amount = .5;
layers.addItem(myObj1);
myObj2.name = "Layer 2";
myObj2.amount = .75;
layers.addItem(myObj2);
}
This is the component code in a file called comps.mySlider.mxml:
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%"
height="100%">
<mx:HSlider id="mySlider" width="100" minimum="0"
maximum="1.25" />
</mx:VBox>
My Datagrid code is below:
<mx:DataGrid dataProvider="{layers}" id="dgSliders">
<mx:columns>
<mx:DataGridColumn headerText="Layer" dataField="name" />
<mx:DataGridColumn headerText="Mix" dataField="amount"
itemRenderer="comps.mySlider"/>
</mx:columns>
</mx:DataGrid>