Robertopriz’s Weblog

Change default background color for selected item in TileList component

Posted in blogging to don't google by robertopriz on June 5, 2009

To change default selectedItem color you need to override a couple of methods extending TileList:

import flash.display.Graphics;
import flash.display.Sprite;

import mx.controls.TileList;
import mx.controls.listClasses.IListItemRenderer;

public class TileLsitEx extends TileList{

public function TileLsitEx()
{
super();
}
override protected function drawSelectionIndicator(indicator:Sprite, x:Number, y:Number,  width:Number, height:Number, color:uint,
itemRenderer:IListItemRenderer):void   {
var g:Graphics = indicator.graphics;
g.clear();
g.beginFill(0x3f4c6b);
g.lineStyle(2,0x6e7c9d);
g.drawRoundRect(x,y,itemRenderer.width,height,15,15);
g.endFill();
return;
}

override protected function drawHighlightIndicator(indicator:Sprite, x:Number, y:Number,width:Number, height:Number, color:uint,
itemRenderer:IListItemRenderer):void   {
return;
var g:Graphics = indicator.graphics;
g.clear();
g.beginFill(0x3f4c6b);
g.lineStyle(2,0x6e7c9d);
g.drawRoundRect(x,y,itemRenderer.width,height,15,15);
g.endFill();
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: