0 Replies Latest reply on Apr 23, 2009 6:39 AM by southernfriedcode

    how to persist a tilelist style, after click?

      i'm trying to have a tilelist that when any item is clicked, it will set a unique skin (selectedUp) and set its label to the word "clicked".
      i need all of the "clicked" items to maintain the (selectedUp) skin, even if something else is clicked.

       

      this code is working, but for some reason it is also selecting every tenth item in the list as well.

       

      import fl.controls.TileList;
      import fl.controls.listClasses.TileListData;
      import fl.controls.listClasses.ImageCell;

       

      tileList.addEventListener(Event.CHANGE, CellClick);

       

      function CellClick(event:Event):void {
          var item = event.target.selectedItem;
          var testItem = tileList.getItemAt(event.target.selectedIndex);
          testItem.label += " - CLICKED";
          var testCell:ImageCell = tileList.itemToCellRenderer(testItem) as ImageCell;
          testCell.setStyle("upSkin", selectedUp);
          testCell.setStyle("downSkin", selectedUp);
          testCell.setStyle("overSkin", selectedUp);
          testCell.setStyle("selectedUpSkin", selectedUp);
          testCell.setStyle("selectedDownSkin", selectedUp);
          testCell.setStyle("selectedOverSkin", selectedUp);
      }

       


      if i comment out the following lines, it stops selecting every tenth item. but how do i make the selected item maintain the skin?
      testCell.setStyle("upSkin", selectedUp);
      testCell.setStyle("downSkin", selectedUp);
      testCell.setStyle("overSkin", selectedUp);

       

      please help if you have any clues.