2 Replies Latest reply on Oct 24, 2011 4:58 AM by jeffreypritchard

    custom itemRenderer states

    jeffreypritchard Level 1



      I have a custom item renderer in a list, which has three states by default: 'normal', 'hovered', and 'selected. When put in the hover state (by a mouse over), a button appears (an 'edit' button), and this all works great. When the button is pressed, the renderer changes state to 'selected' which changes the state of the parent container to a 'details' view. The problem occurs when I'm done making my changes in the details view, and return to the list view. The renderer seems to be stuck in the 'selected' state (showing the 'edit' button while NOT hovered. Even hovering over the item renderer does not seem to have any effect on the item renderer's state.


      Am I missing something ? Is there an event that fires every time an item renderer is shown that can 'reset' it's state to normal ?. I hope I explained the situation well enough, although I'm not sure I have.


      Thanks in advance

        • 1. Re: custom itemRenderer states
          Shongrunden Adobe Employee

          The selected state takes precedence over the hovered state and there is no "hoveredAndSelected" state, for example:


          <?xml version="1.0" encoding="utf-8"?>

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"








                                  <s:State name="normal" />

                                  <s:State name="hovered" />

                                  <s:State name="selected" />



                              <s:Rect width="100%" height="100%">


                                      <s:SolidColor color.normal="green"


                                                    color.selected="red" />




                              <s:Label text="{data}" />

















          You should be able to add that state to your ItemRenderer by overriding ItemRenderer.getCurrentRendererState().

          1 person found this helpful
          • 2. Re: custom itemRenderer states
            jeffreypritchard Level 1

            Thanks a lot,


            I got the result I needed by doing exactly that, overriding getCurrentRendererState().