Hello Sameer! Thank you for feedback. I studied a little about the styleFunction and could solve my problem. The code was as below:
public function myColStyleFunc(data:Object, col:AdvancedDataGridColumn):Object { var cor:int; var val:int = parseInt(data[col.dataField]); if(val < 13) cor = 0xDB0E0E; else if(val >=13 && val < 18) cor = 0xFFCC00; else if(val >= 18) cor = 0x00CC00; else return null; return {color:cor}; } Hugs! On 14 jan, 15:08, Sameer <prosam...@gmail.com> wrote: > Use styleFunction > > On Jan 14, 10:09 pm, Berkowitz - Fator13 <rafael.rafael...@gmail.com> > wrote: > > > Well guys ... I managed to resolve. I do not know if it is the best > > way, but > > worked. > > The code was as below: > > > <mx:AdvancedDataGridColumn > > dataField="mediaBC" headerText="Média B/C" > > textAlign="center" fontWeight="bold" color="#0066CC" > > width="70"> > > > <mx:itemRenderer> > > <mx:Component> > > <mx:Label > > text="{data.mediaBC}" > > > > color="{(parseInt(data.mediaBC)<13)?0xDB0E0E:(parseInt > > (data.mediaBC)>=13 && parseInt(data.mediaBC)<18)? > > 0xFFCC00:0x00CC00}" > > /> > > </mx:Component> > > </mx:itemRenderer> > > </mx:AdvancedDataGridColumn> > > > Thank you! > > > On 13 jan, 15:13, Berkowitz - Fator13 <rafael.rafael...@gmail.com> > > wrote: > > > > Hello everybody! > > > > I'm a C# developer and I'm starting to work with FLEX too. > > > I created a ADG with a SummaryFunction that calculates the average of > > > the values: > > > > private function summFunc(cursor:IViewCursor, dataField:String, > > > operation:String):Number { > > > var _auxConta:Number = 0; > > > var oddConta:String; > > > var count:int = 0; > > > var cor:uint; > > > > while(!cursor.afterLast) { > > > _auxConta += cursor.current[dataField]; > > > > cursor.moveNext(); > > > count++; > > > } > > > > oddConta = (_auxConta/count).toFixed(2); > > > > return parseFloat(oddConta); > > > } > > > > How do I change the color of the label based on the calculation > > > below? > > > > if(parseInt(oddConta) < 13) cor = 0xDB0E0E; > > > else if(parseInt(oddConta) >= 13 && parseInt(oddConta) < 18) cor > > > = > > > 0xFFCC00; > > > else cor = 0x00CC00; > > > > Sorry for my bad english. > > > Thank you! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@googlegroups.com To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---