1) dataGroup.getElementAt won't return renderers for non-visible items
2) dataGroup.verticalScrollPosition is measured in pixels not items
3) dataGroup.getElementAt cannot receive an index based on the dataProvider
because if the 10th item is the first visible item, the index of the renderer
for the 10th item is the element at position 0.
4) ensureIndexIsVisible works, but does not tell us where the item renderer is
positioned in the dataGroup so we still have to seach the elements of the
dataGroup to get the item of interest.
Interestingly enough, if you create a list of height 100 with 5 data items and
use an item renderer with height 50 so only 2 items show at a time, the
dataGroup's numElements property will equal 5, yet cycling through them, three
will be null.
To get indexToItemRenderer type functionality, you need to:
myList.ensureIndexIsVisible(4);
myList.validateNow();
for (var i:int = 0; i < myList.dataGroup.numElements; i++)
{
var element:IVisualElement = myList.dataGroup.getElementAt(i);
if (element != null)
{
if (ItemRenderer(element).data == dp.getItemAt(indexOfInterest))
{
return element;
}
}
}
--- In [email protected], Alex Harui <aha...@...> wrote:
>
> I haven¡Çt actually tried it but you could use
>
>
> 1. dataGroup.getElementAt
> 2. dataGroup.verticalScrollPosition
> 3. dataGroup.getElementAt(dataProvider.getItemIndex(item)) != null)
> 4. ensureIndexIsVisible
>
>
> On 1/21/10 7:14 PM, "j2me_soul" <j2me_s...@...> wrote:
>
>
>
>
>
>
> yes, I find this problem too.
>
> Is anybody figure out this ?
>
>
> ºß2010-01-22 02:59:50¡¤"Ariel J" <arielj...@...> ¼ÌÆ»¡§
>
> Where are these methods in the spark list control:
>
> 1) indexToItemRenderer()
>
> 2) set verticalScrollPosition() - that uses the index of the item in the data
> provider
>
> 3) isItemVisible()
>
> 4) scrollToIndex
>
> I am also not finding them in DataGroup.
>
>
>
>
>
>
>
>
> --
> Alex Harui
> Flex SDK Team
> Adobe System, Inc.
> http://blogs.adobe.com/aharui
>