--- In flexcoders@yahoogroups.com, "Brad Keck" <bradley_k...@...> wrote: > > I am having a weird problem. I have created a custom list class in > order to customize the highlight behavior of the list. Everything > seems to be working great EXCEPT when I use the *mouse wheel* to > scroll, my highlighting gets off. (The wrong item in the list is > highlighted as I roll over items.) > > Any ideas of what might be going on here? > > > > > Here is my code: > > 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(color); > g.drawRoundRect(x,y+8,width-10,height-16,20,20); > g.endFill(); > } > > > And for comparison, here is the code in listBase.as: > > 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(color); > g.drawRect(0, 0, width, height); > g.endFill(); > > indicator.x = x; (I have tried adding these lines in, > indicator.y = y; but they just screw things up bad.) > } >
In case anybody ever stumbles on something similar, I figured out the problem. I needed to match the overridden function more closely. Here was my final code that worked correctly: 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(color); g.drawRoundRect(0,0,width-10,height-16,20,20); g.endFill(); indicator.x = x; indicator.y = y+8; }