//로우 색처리 ===========================================================
private var _rowColorFunction : Function;

public function set rowColorFunction( f : Function ) : void {
   this._rowColorFunction = f;
}
public function get rowColorFunction() : Function {
   return this._rowColorFunction;
}

private var displayWidth : Number;

override protected function updateDisplayList( unscaledWidth : Number, unscaledHeight : Number) : void {
   super.updateDisplayList(unscaledWidth, unscaledHeight);
   if (displayWidth != unscaledWidth - viewMetrics.right - viewMetrics.left) {
      displayWidth = unscaledWidth - viewMetrics.right - viewMetrics.left;
   }
}

override protected function drawRowBackground(s : Sprite, rowIndex : int, y : Number, height : Number, color : uint, dataIndex : int) : void {
   if( this.rowColorFunction != null ) {
      if( dataIndex < (this.dataProvider as ArrayCollection).length ) {
         var item:Object = (this.dataProvider as ArrayCollection).getItemAt(dataIndex);
         color = this.rowColorFunction.call(this, item, color);
      }
   }
   super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);
}
사용방법
private function selectTypeColor( item : Object, color : uint) : uint {
   if( item['컬렉션명'] == "값" )  {
      return 0xFFFF00;
   }
   return color;
}


   
      
         
         
      
   

posted by 느릅나무™