Thank Alex, I put a conditional around my value object so that if there is no data it is ignored. Now once my list loads the items are colored accordingly.
----- Original Message ---- From: Alex Harui <[EMAIL PROTECTED]> To: "flexcoders@yahoogroups.com" <flexcoders@yahoogroups.com> Sent: Friday, September 12, 2008 10:01:48 PM Subject: RE: [flexcoders] mx:List and custom item background colors The value parameter in the data setter should have valid values, but at startup it might get passed an unexpected value. I’d just check to make sure the data is valid and ignore bad data and see if you get further and get valid values later.. From:[EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf Of Cordova Aaron Sent: Friday, September 12, 2008 4:17 PM To: [EMAIL PROTECTED] ups.com Subject: [flexcoders] mx:List and custom item background colors I have been working at this for a few hours now. I have seen examples for several list controls other than just mx:List. I thought this example was the most promising to accomplish what I am trying to do. <mx:itemRenderer> <mx:Component> <mx:HBox paddingLeft="2"> <mx:Script> <![CDATA[ override public function set data( value:Object ) : void { super.data = value; var today:Number = (new Date()).time; var pubDate:Number = Date.parse(data. date); if( pubDate > today ) setStyle("backgroundColor",0xff99ff); else setStyle("backgroundColor",0xffffff); } ]]> </mx:Script> <mx:Image source="{data.image}" width="50" height="50" scaleContent="true" /> <mx:Text width="100%" text="{data.title}" /> </mx:HBox> </mx:Component> </mx:itemRenderer> But this example is from a dataGrid and the var value has no value when using this method in a mx:List control. All I want to do is change the bacground color of the mx:HBox dependent on another value from data. Any ideas?