4 Replies Latest reply on Feb 11, 2010 11:56 AM by david.t.lanton

    Programmatically selecting hovered state of item renderer - Greg pleeease

    david.t.lanton Level 1

      I'm a bit new to Flex, so I have the idea but can't get it to work.


      I'm using an item renderer that takes its data from an HTTPService



                                    skinClass="extras.BoSkin" />


      the boData data provider is an ArrayCollection not an Array


      In my <s:ItemRenderer ...... > (BoItemRenderer.mxml)  I have

      - 2 states: normal and hovered (each has different style, which I will leave out to keep things simple)

      - and the data is presented as follows:


              <s:Label text="{data.idNum}" />         
              <s:Label text="{data.firstName}" />
              <s:Label text="{data.lastName}" />


      Naturally as I hover on any row in the item renderer, it changes to the hovered state styling, all done by flex.

      What I want to do however is programmatically induce that hover state without actually hovering.

      For example, given a hard-coded idNum, I need to programmatically set the state of that row to hovered.


      My approach is as follows, but not sure how to target that specific item,

      - search the dataProvider to find the index of the row with idNum that matches my hard-coded value. I looked at the documentation, and there is indexOf, but it's for Array and not ArrayCollection.. also not sure how that works since I'd like to read the data from the item renderer directly, not from the original data provider.

      - then I would find that index in the itemrenderer and set the state of that index to hovered.


      Simpler said then done, but I'm stuck on it...