So, with Alex's suggestion, this is a lot cleaner:
override protected function drawHighlightIndicator(indicator:Sprite,
x:Number, y:Number, width:Number, height:Number, color:uint,
itemRenderer:IListItemRenderer):void
{
if (isItemSelected(itemRenderer.data))
{
return;
}
super.drawHighlightIndicator(indicator, x, y, unscaledWidth -
viewMetrics.left - viewMetrics.right, height, color, itemRenderer);
}
-TH
--- In [email protected], "Tim Hoff" <timh...@...> wrote:
>
>
> Yeah, that makes sense; since it also considers highlighting with the
> keyboard.
>
> -TH
>
> --- In [email protected], Alex Harui aharui@ wrote:
> >
> > I'd just override drawHighlightIndicator...
> >
> > Alex Harui
> > Flex SDK Developer
> > Adobe Systems Inc.<http://www.adobe.com/>
> > Blog: http://blogs.adobe.com/aharui
> >
> > From: [email protected] [mailto:[email protected]]
> On Behalf Of Tim Hoff
> > Sent: Wednesday, February 11, 2009 1:17 PM
> > To: [email protected]
> > Subject: [flexcoders] Re: preventing flex List rollover indicator to
> draw on selected item.
> >
> >
> > Here's an easy way:
> >
> > Extend List
> >
> > override protected function mouseOverHandler(event:MouseEvent):void
> > {
> > var item:IListItemRenderer = mouseEventToItemRenderer(event);
> >
> > super.mouseOverHandler(event);
> >
> > if (highlightIndicator && item && isItemSelected(item.data))
> > {
> > clearHighlightIndicator(highlightIndicator, item);
> > }
> > }
> >
> > -TH
> >
> > --- In [email protected], Thibaud Van Vreckem thibaudmail@
> wrote:
> > >
> > > This thing has always bugged me.
> > > the rollover effect should never appear on a selected item in a
> list.
> > > unfortunately that's not how the List works.
> > >
> > > The list is using an itemrenderer implementing
> IDropInListItemRenderer.
> > > and I already do various visual changes using the:
> > > ListBase(owner).isItemHighlighted(data)
> > > and
> > > ListBase(owner).isItemSelected(data)
> > > in the itemrenderer.
> > >
> > > I imagine I could:
> > > 1. get rid off the rollover effect entirely by setting the list
> useRollOver
> > > style property to false and handling the rollover through the
> itemrenderer.
> > > 2. make an new List class and override it's
drawHighlightIndicator()
> method.
> > >
> > > any idea how to prevent drawHighlightIndicator() to operate on
the>
> selectedItem ?
> > > any other solution ?
> > >
> > > thanks
> > >
> >
>