Use : event.currentTarget.selectedItem; That will return a reference to the currently selected item object in the dataProvider.
Alternatively, you could do: ArrayResults.getItemAt(event.CurrentTarget.selectedIndex) Tracy Spratt, Lariat Services, development services available _____ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of lehaianh1986 Sent: Monday, March 30, 2009 10:50 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: AdvancedDatagrid I use the line to test. It show the row index in advanceddatagrid that I want to select. What I need is data of object in each row I select. But how to give it? --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com, "Tracy Spratt" <tspr...@...> wrote: > > What are you trying to do with the line?: > > AdvancedDataGrid(event.currentTarget).selectedIndex = event.rowIndex; > > > > As it is is sets the selectedIndex to itself. rowIndex is the > selectedIndex. > > > > Tracy Spratt, > > Lariat Services, development services available > > _____ > > From: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com [mailto:flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com] On > Behalf Of lehaianh1986 > Sent: Monday, March 30, 2009 10:29 PM > To: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com > Subject: [flexcoders] Re: AdvancedDatagrid > > > > Yeah I see. Thank you very much. I still have small question > To give index of row I use > AdvancedDataGrid(event.currentTarget).selectedIndex = event.rowIndex; > > But to give data of it, how do I do? > > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com, > "Tim Hoff" <TimHoff@> wrote: > > > > > > Missed the return void. > > > > private function myEventHandler( event:ListEvent ):void > > { > > // do something > > } > > > > -TH > > > > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com, > "Tim Hoff" <TimHoff@> wrote: > > > > > > > > > Just a syntax problem. Should be like this: > > > > > > var client:AdvancedDataGrid = new AdvancedDataGrid; > > > client.dataProvider = ArrayResults; > > > client.addEventListener( ListEvent.ITEM_CLICK , myEventHandler ); > > > > > > private function myEventHandler( event:ListEvent ) > > > { > > > // do something > > > } > > > > > > -TH > > > > > > Also, I'd suggest that you use an ArrayCollection instead of an array; > > > if you want to do any data manipulation. > > > > > > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> > ups.com, "lehaianh1986" lehaianh1986@ > > > wrote: > > > > > > > > Hi every body. I have a AdvancedDatagird and dataprovider from Array > > > Collection. How to listen an event when I click to each row? I want > > use > > > an event when I click left mouse, right mouse, double click,...etc > > > > > > > > My code is here but it not run > > > > > > > > var client:AdvancedDataGrid = new AdvancedDataGrid; > > > > client.dataProvider = ArrayResults; > > > > > > > > > client.addEventListener(ListEvent.ITEM_CLICK,function(event:ListEvent):v\ > > \ > > > oid > > > > { > > > > ... > > > > }); > > > > > > > > > >