tags:

views:

295

answers:

1

In Flex 4 (beta 2), I have a list control populated from an XMLListCollection.

What I would like to do is when an item is selected in the list, use a custom item renderer on the selected item as well as the item that appears just prior to the selected item in the list.

I am using a spark list control, but I am open to alternate components if the solution makes sense.

Here is the strucutre of the xml used to populate the XMLListCollection

<Images>
   <Image>
      <Id>1</Id>
      <Url>http://www.mydomain.com/image1.png&lt;/Url&gt;
   </Image>
   <Image>
      <Id>2</Id>
      <Url>http://www.mydomain.com/image2.png&lt;/Url&gt;
   </Image>
<Images>

Thank you in advance.

A: 

Why not use one itemRenderer which has a number of states which vary based on what the current data is? That would accomplish your goal in a much faster, simpler, and maintainable fashion.

Christopher W. Allen-Poole
I currently have an itemRenderer that behaves differently for the list item currently being hovered over. That works great. My remaining problem is how do I determine the item to the left of the item being hovered over and changes its itemRenderer state as well.
Jason W