<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/03/06/setting-the-background-alpha-and-background-color-of-a-datagrid-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
		layout="vertical"
		backgroundColor="white" viewSourceURL="srcview/index.html">

	<mx:Script>
		<![CDATA[
			private var defaultAlternatingItemColors:Array = [0xF7F7F7, 0xFFFFFF];

			private function checkBox_change(evt:Event):void {
				if (checkBox.selected) {
					dataGrid.setStyle("alternatingItemColors", defaultAlternatingItemColors);
				} else {
					dataGrid.setStyle("alternatingItemColors", []); 
				}
			}
		]]>
	</mx:Script>

	<mx:ArrayCollection id="arrColl">
		<mx:source>
			<mx:Array>
				<mx:Object c1="ColumnA.1" c2="ColumnB.1" />
				<mx:Object c1="ColumnA.2" c2="ColumnB.2" />
				<mx:Object c1="ColumnA.3" c2="ColumnB.3" />
				<mx:Object c1="ColumnA.4" c2="ColumnB.4" />
				<mx:Object c1="ColumnA.5" c2="ColumnB.5" />
				<mx:Object c1="ColumnA.6" c2="ColumnB.6" />
				<mx:Object c1="ColumnA.7" c2="ColumnB.7" />
				<mx:Object c1="ColumnA.8" c2="ColumnB.8" />
				<mx:Object c1="ColumnA.9" c2="ColumnB.9" />
			</mx:Array>
		</mx:source>
	</mx:ArrayCollection>

	<mx:ApplicationControlBar dock="true">
		<mx:Form styleName="plain">
			<mx:FormItem label="backgroundAlpha:">
				<mx:HSlider id="slider"
						minimum="0.0"
						maximum="1.0"
						value="1.0"
						liveDragging="true" />
			</mx:FormItem>
			<mx:FormItem label="backgroundColor:">
				<mx:ColorPicker id="colorPicker"
						selectedColor="purple" />
			</mx:FormItem>
			<mx:FormItem label="use alternatingItemColors:">
				<mx:CheckBox id="checkBox"
						label="[0xF7F7F7, 0xFFFFFF]"
						selected="true"
						change="checkBox_change(event);" />
			</mx:FormItem>
		</mx:Form>
	</mx:ApplicationControlBar>

	<mx:DataGrid id="dataGrid"
			dataProvider="{arrColl}"
			backgroundColor="{colorPicker.selectedColor}"
			backgroundAlpha="{slider.value}"
			width="300"
			rowCount="6"
			verticalScrollPolicy="on" />

</mx:Application>

