creationComplete only gets called once. You need to react to dataChange. ________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of cjsutherland Sent: Thursday, September 06, 2007 9:19 AM To: [email protected] Subject: [flexcoders] DataGrid Scrolling Weirdness Hi y'all, I'm having a problem with my DataGrid. I'm using a custom component as an ItemRenderer in one of the cells. It generates two buttons. The buttons are colored differently depending on the data. It looks like this: <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " creationComplete="colorizeIt();"> <mx:Script> <![CDATA[ public function colorizeIt():void { if (data.remarks == "FIRST BAG") { first.setStyle("color","yellow"); last.setStyle("color","white"); } else { first.setStyle("color","white"); last.setStyle("color","yellow"); } } ]]> </mx:Script> <mx:Button fontSize="12" label="FIRST" id="first" /> <mx:Button fontSize="12" label="LAST" id="last" /> </mx:HBox> This works when the grid is displayed. However, when I scroll through the data grid, the colors of the buttons are changed, seeming randomly. I scroll down, then back up, and the colors have swapped. Another scroll through and back up, and some have returned to their proper color, some have not. Any ideas as to what's going on here, and is this correctable? Thanks! -cj

