I am a bit nervous about your question, and why you want to do that.

 

First, do you understand why "... rowInfo[25] it throws an error."?

 

While directly accessing the visual elements of a data-driven control is
sometimes valid, it is more often due to a misunderstanding of the way
those controls work.

 

Now, if you set verticalScrollPosition = 25, then the row you want will
be in the first renderer instance and you could probably figure out the
location from that.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of blc187
Sent: Tuesday, July 29, 2008 4:56 PM
To: [email protected]
Subject: [flexcoders] Re: how to get the y position of item in list

 

In order to get that I would have to click on the item.
I'm not clicking, I just need to scroll then grab the position of the 
item.
Thanks for the try, but this is not a viable solution.

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Tim Hoff" <[EMAIL PROTECTED]> wrote:
>
> 
> Here's one way. If you're scrolling to the index and setting the
> currentItem, you an use this code with the change event:
> 
> private function onItemClick(event:ListEvent):void
> {
> var pt:Point = new Point(event.itemRenderer.x,
> event.itemRenderer.y);
> pt = event.currentTarget.localToGlobal(pt);
> Alert.show(pt.y.toString());
> }
> 
> <mx:List itemClick="onItemClick(event)">
> -TH
> 
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> , "blc187" <blc187@> wrote:
> >
> > Is there a way to get the y position of a row in a list or 
datagrid?
> >
> > I noticed that list has a protected var rowInfo that holds an 
array of
> > ListRowInfo objects with x and y properties.
> > From the list class I could do rowInfo[rowNumber].y but am trying 
to
> > get the y value from outside the list though...
> >
> > Also, rowInfo only holds info for the visible rows.
> > For example, I have a list with 65 items, 20 of which are shown 
before
> > the scrollbar shows up.
> >
> > I want to get rowInfo[5], fine.
> > I want to get rowInfo[25] it throws an error.
> >
> > So I need to scrollToIndex(25) but then I don't know which entry 
in
> > rowInfo corresponds to my selected item.
> >
>

 

Reply via email to