2 Replies Latest reply on May 22, 2008 1:38 AM by Chris Ivens

    Tilelist Custom Selected Item Skin

    coltrane2006
      Hi -

      I have a class that extends Tilelist and I am also using a custom renderer that is derived from Button. For the button renderer I am using an embedded graphic for the upSkin, overSkin, etc. I would also like to utilize this same skin graphic to show the selected item in the Tilelist. In other words, instead of utilizing selectionColor - I would like the skin graphic to show the selected item.

      I have tried setting the focusSkin style in the Tilelist with the same graphic without any luck. I have tried many syntactic variations but I'm thinking that focus skin works only for focus as in tabbing and not for selection? If I am incorrect about this I would very much appreciate some sample code for doing this.

      I am currently trying to find a code based solution. Setting the active item in actionscript without a Tilelist is very simple. I have created a listener for the change event, but I'm not sure how to access the selected renderer instance within a Tilelist.

      Thanks!

      Peter
        • 1. Re: Tilelist Custom Selected Item Skin
          Chris Ivens
          Has anyone found a solution to this? I'm trying to do a similar thing. It would be great if it were possible to detect whether the item is selected or not within an itemRenderer.
          • 2. Re: Tilelist Custom Selected Item Skin
            Chris Ivens Level 1
            I think I have a way of making it work without too many overheads. ListBase has a few functions to help with the drawing of items so overriding them and adding a little extra functionality seemed to be easy enough.

            Create a custom actionscript class that extends the relevant list type; in my case TileList. Override the drawItem method to pass the 'selected' variable into the itemRenderer.

            So basically the item is your itemrenderer and calling a setter/getter or any other method is possible as the item is drawn. Seems to work well for me.