2

I have a list that has alternating item colors.

<s:List id="myList" change="selectionChanged(event)" alternatingItemColors="[0x000000, 0xFFFFFF]" dataProvider="{alResults}" itemRenderer="itemRenders.Results" width="100%"></s:List>

I just simply want the item backgrounds to be transparent.

In the opening tag of the ItemRenderer, I tried this, but didn't work.

<s:ItemRenderer name="Results"
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    autoDrawBackground="true"
    contentBackgroundAlpha="0.2">

I tried setStyle in the data override method as well, and didn't work either. Thanks.

ToddBFisher
  • 11,370
  • 8
  • 38
  • 54
David
  • 607
  • 1
  • 8
  • 12
  • 1
    ItemRenderers are transparent by default (except on rollover when `autoDrawBackground="true"` ). It is the List that has a background. – RIAstar Jan 25 '12 at 09:09

2 Answers2

5

ItemRenderer: autoDrawBackground="false" will disable its background.
List: you can use contentBackgroundColor to change background color or contentBackgroundAlpha="0" to make it transparent.

vk23
  • 468
  • 7
  • 16
4

One thing that comes to mind is to try adding transparency to the actual colors.

alternatingItemColors="[0x33000000, 0x33FFFFFF]"

If my math is right the 33 in hex would be around 0.2 alpha.

I've never done it in Flex but I've used it multiple times in Flash. Worth at least a try.

ToddBFisher
  • 11,370
  • 8
  • 38
  • 54
  • Did this actually worked? I can't seem to make it happen... im setting both colors to 0x00000000, which should be transparent black so to speak, but instead of the background I have on the list, I get a black background per list item. – Orgmir Apr 08 '13 at 17:58