Get data from selected row in DataGrid
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:VBox> <mx:DataGrid id="grid" width="500" change="output.text =grid.selectedItem.city"> <mx:columns> <mx:DataGridColumn headerText="City" dataField="city" /> <mx:DataGridColumn headerText="Population" dataField="population" /> </mx:columns> <mx:ArrayCollection> <mx:Array> <mx:Object city="A" state="CA" population="3" /> <mx:Object city="B" state="NY" population="8" /> <mx:Object city="C" state="IL" population="2" /> <mx:Object city="D" state="PA" population="1" /> </mx:Array> </mx:ArrayCollection> </mx:DataGrid> <mx:TextInput id="output" width="200" /> </mx:VBox> </mx:Application>