Personally, I override LabelItemRenderer.drawBackground(). It gets called
at the appropriate times.

override protected function drawBackground(unscaledWidth:Number,
unscaledHeight:Number):void
{
    if (unscaledHeight == 0)
        return;
    var c:uint;
    c = selected ? Constant_Color.LIST_ITEM_BACKGROUND__SELECTED :
Constant_Color.LIST_ITEM_BACKGROUND;
    graphics.beginFill(c, 1);
    graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
    graphics.endFill();
    graphics.lineStyle(1, 0xC0C0C0);
    graphics.moveTo(0, unscaledHeight - 1);
    graphics.lineTo(unscaledWidth, unscaledHeight - 1);
    graphics.lineStyle(1, 0xFFFFFF);
    graphics.moveTo(0, unscaledHeight);
    graphics.lineTo(unscaledWidth, unscaledHeight);
}

HTH,

Douglas


On Wed, May 3, 2017 at 12:26 AM, bilbosax <waspenc...@comcast.net> wrote:

> Basically, I have a list with a custom itemrenderer containing an image,
> and
> I need to create an overlay over my custom itemrenderer to let a user know
> that the item has been selected, and when they select something else, I
> need
> it to turn off. Inside the itemrenderer, I need to know what event to react
> to to make these changes.
>
> My approach was to create an overlay rectangle in the itemrenderer. When a
> user clicks on the list, an item becomes selected.  Inside the
> itemrenderer,
> when this happens, I need the itemrenderer to change the visibility of the
> overlay rectangle that I have created to let the user know that the item
> has
> been selected.  I decided to test the "selected" Boolean value of the
> itemrenderer to change the visibility of the overlay rectangle.  The only
> problem is, I don't know what event to react to so that I can test if the
> itemRenderer is selected or not.  DataChange is not the appropriate event.
> Does anyone know what event I should react to in the itemrenderer?
>
> Any thoughts greatly appreciated!
>
>
>
> --
> View this message in context: http://apache-flex-users.
> 2333346.n4.nabble.com/ItemRenderer-What-event-to-react-to-tp15157.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Reply via email to