有人知道如何将自定义rolloveridicators添加到flex 3列表组件吗? 它在css中没有rolloveridicatorskin。
答案 0 :(得分:0)
如果您只想更改所显示项目的背景和文本颜色,ListBase类将定义以下样式:
rollOverColor
0xEEFEE6
。textRollOverColor
类似于:
<mx:List rollOverColor="#FF0000" textRollOverColor="#FFFF00"/>
当您将鼠标移到某个项目上时,会在红色背景(!)上显示黄色文字。
答案 1 :(得分:0)
这是代码。
package
{
import flash.display.Graphics;
import flash.display.Sprite;
import flash.filters.DropShadowFilter;
import mx.controls.List;
import mx.controls.listClasses.IListItemRenderer;
import mx.core.ClassFactory;
public class friendList extends List
{
private var dropShadow:DropShadowFilter = new DropShadowFilter(2,117,0x000000,0.4);
private var filtersArray:Array = new Array(dropShadow);
override protected function drawSelectionIndicator(indicator:Sprite, x:Number,
y:Number, width:Number, height:Number, color:uint,
itemRenderer:IListItemRenderer):void
{
var g:Graphics = Sprite(indicator).graphics;
g.clear();
g.beginFill(0x000000, 0.5);
g.lineStyle(2,0xffffff,0.5);
g.drawRoundRect(0, 0, width-2, height-2, 6);
g.endFill();
indicator.x = x;
indicator.y = y;
indicator.filters = filtersArray;
}
override protected function drawHighlightIndicator(
indicator:Sprite, x:Number, y:Number,
width:Number, height:Number, color:uint,
itemRenderer:IListItemRenderer):void
{
var g:Graphics = Sprite(indicator).graphics;
g.clear();
g.beginFill(0x163e76, 0.5);
g.lineStyle(2,0xffffff,0.5);
g.drawRoundRect(0, 0, width-2, height-2, 6);
g.endFill();
indicator.x = x;
indicator.y = y;
indicator.filters = filtersArray;
}
}
}