Ok, no worries. Take 2:
import mx.controls.listClasses.IListItemRenderer;
private function scrollToListItem( index : Number )
{
myList.scrollToIndex(index);
myList.selectedIndex = index;
var itemRenderer:IListItemRenderer =
myList.indexToItemRenderer(index);
var pt:Point = new Point(itemRenderer.x, itemRenderer.y);
pt = itemRenderer.localToGlobal(pt);
Alert.show(pt.y.toString());
}
<mx:List id="myList"/>
<mx:Button click="scrollToListItem(25)"/>
-TH
--- In [email protected], "blc187" <[EMAIL PROTECTED]> wrote:
>
> 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], "Tim Hoff" TimHoff@ 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], "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.
> > >
> >
>