

Ans:
I think this is pretty good example for you. Please check this.
Itemrenderer.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
autoDrawBackground="false">
<fx:Script>
<![CDATA[
[Bindable]
public var myBGColor:int = 0xFFFFFF;
override public function set itemIndex(value:int):void {
if ((value%2) == 0) {
myBGColor= 0xFFFFFF;
}
if ((value%2) == 1) {
myBGColor= 0xCCFF66;
}
}
]]>
</fx:Script>
<s:states>
<s:State name="normal"/>
<s:State name="hovered"/>
</s:states>
<s:Rect id="myRect"
left="0" right="0" top="0" bottom="0"
alpha="1.0">
<s:stroke>
<s:SolidColorStroke
color="0xA8C6EE"
weight="1"/>
</s:stroke>
<s:fill>
<s:SolidColor
color="{myBGColor}"/>
</s:fill>
</s:Rect>
<s:Label id="labelDisplay"
verticalCenter="0"
left="3" right="3" top="6" bottom="4"
fontSize.hovered='14' fontStyle.hovered="italic"/>
</s:ItemRenderer>
main.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:SkinnableDataContainer
itemRenderer="myComponents.MyAlternatingItemRenderer">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<mx:ArrayList>
<fx:String>Bill Smith</fx:String>
<fx:String>Dave Jones</fx:String>
<fx:String>Mary Davis</fx:String>
<fx:String>Debbie Cooper</fx:String>
</mx:ArrayList>
</s:SkinnableDataContainer>
</s:Application>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.