[flexcoders] Re: DataGrid Scrolling Weirdness

2007-09-06 Thread cjsutherland
I can't believe it was that simple.  I was working for hours on this.
 Thanks a million Alex.

-cj

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 creationComplete only gets called once.  You need to react to
 dataChange.
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of cjsutherland
 Sent: Thursday, September 06, 2007 9:19 AM
 To: flexcoders@yahoogroups.com
 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





RE: [flexcoders] Re: DataGrid Scrolling Weirdness

2007-09-06 Thread Alex Harui
For more info: (blogs.adobe.com/aharui)



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of cjsutherland
Sent: Thursday, September 06, 2007 11:39 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: DataGrid Scrolling Weirdness



I can't believe it was that simple. I was working for hours on this.
Thanks a million Alex.

-cj

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Alex Harui [EMAIL PROTECTED] wrote:

 creationComplete only gets called once. You need to react to
 dataChange.
 
 
 
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] On
 Behalf Of cjsutherland
 Sent: Thursday, September 06, 2007 9:19 AM
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
 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 
 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