0 Replies - 477 Views - Last Post: 23 April 2009 - 06:28 AM

#1 southernfried  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-April 09

how to persist a tilelist style, after click?

Posted 23 April 2009 - 06:28 AM

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.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1