Removing the theme color from the Flex TileList

There have been a number of occasions when the designs for a UI implements some kind of grid layout to display its items. This is fairly simple to implement in flex by utilising the Flex TileList component. However more often than not the List's item renderers are required to look after their own states. In this case the TileLists Indicators are no longer required.

I have found the easiest way to remove the TileLists indicators is to set the ThemeColor to the background color of whatever the List is being displayed on. But what happens if the background contains an image or has a transparency value?

To do this you need to override the TileLists drawSelectionIndicator and drawHighlightIndicator methods.

view plain print about
1override protected function drawSelectionIndicator(
2 indicator:Sprite, x:Number, y:Number,
3 width:Number, height:Number, color:uint,
4 itemRenderer:IListItemRenderer):void
5{
6/* we don't need to do anything in here*/
7}
8override protected function drawHighlightIndicator(
9 indicator:Sprite, x:Number, y:Number,
10 width:Number, height:Number, color:uint,
11 itemRenderer:IListItemRenderer):void
12{
13/* we don't need to do anything in here*/
14}

Notice that the body to the above methods are empty. This is because we don't want the indicators to draw anything behind the renderers when the state changes.

Now just don't forget to cater for this inside your TileList's item renderer else the user will get confused as to which item is selected and which item their mouse is over. We wouldn't want that would we :)

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
TiTerm's Gravatar for drawHighlightIndicator, it s may be easier to set the useRollOver style to false
# Posted By TiTerm | 8/6/08 7:51 AM
Ben's Gravatar Hi TiTerm,

The issue I have is for the selected item color. It will still use the theme background color even though useRollOver is set to false.
# Posted By Ben | 8/6/08 6:39 PM
Lany's Gravatar At http://rapidpedia.com/ there is a nice teaching application for the issues like this. I was of goog avail for me and considerably helped me with my work.
# Posted By Lany | 2/6/09 3:13 AM
Fabio's Gravatar Thanx for tip! Useful
# Posted By Fabio | 3/6/09 12:49 PM
Ben's Gravatar Hey Fabio,

No problem glad you found it useful
# Posted By Ben | 3/9/09 3:29 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.6.004. Contact Blog Owner