The following code is working fine with flex 3 project
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
[Bindable]
private var coll:ArrayCollection = new
ArrayCollection();
protected function
application1_creationCompleteHandler(event:FlexEvent):void
{
for (var i:int = 0; i <10; i++)
{
var obj:Object = new Object();
obj.name = "abc" + i;
coll.addItem(obj);
}
}
]]>
</mx:Script>
<mx:ComboBox id="serverStatus" prompt="Please set server status..."
dataProvider="{coll}" width="100%">
<mx:itemRenderer>
<mx:Component>
<mx:Box backgroundColor="red" width="100%"
height="30"
label="{data.name}">
<mx:Label text="{data.name}"/>
</mx:Box>
</mx:Component>
</mx:itemRenderer>
</mx:ComboBox>
As u are using flex 4, I would suggest you to use spark components
<s:Combobox/> or <s:DropDownList/> like this
<s:ComboBox id="serverStatus"
dataProvider="{expenses}" width="100%">
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<mx:Box backgroundColor="red"
width="100%" height="30"/>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:ComboBox>
<s:DropDownList id="serverStatus2" prompt="Please set server
status..."
dataProvider="{expenses}" width="100%">
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<mx:Box backgroundColor="red"
width="100%" height="30"/>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:DropDownList>
Also note that prompt property is available in spark DropDownList but
not in spark Combobox.
Hope that helps :)
Regards
Haroon
On Mar 22, 3:27 pm, rohit <[email protected]> wrote:
> This code is not working in flex 4. Do any one have any idea?
>
> <mx:ComboBox id="serverStatus" prompt="Please set server status..."
> dataProvider="{expenses}" width="100%">
> <mx:itemRenderer>
> <mx:Component>
> <mx:Box backgroundColor="red" width="100%"
> height="30"/>
> </mx:Component>
> </mx:itemRenderer>
> </mx:ComboBox>
>
> Box background color in always white in ComboBox rather than Red
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.