I have a AdvancedDataGrid that I would like to generate a colored square bitmap as the icon, and give it to iconFunction.
But iconFunction required the return of Class, but I have the BitmapData generated, can anyone provide a solution? Thanks.
Here is my code :
private function iconCallBack(item:Object):Class
var layerNode:LayerItemVO = item as LayerItemVO;
var iconBitmap:BitmapData = new BitmapData (14, 14, false, layerNode.color); //generated the bitmap based on the passed in color
return iconBitmap; // wrong, because it needs to return Class, please help?
<mx:AdvancedDataGrid id="layer_datagrid" iconFunction="iconCallBack" >
You can't generate a class at runtime. A custom renderer can have its own
logic for drawing graphics and not require iconFunction. Also, it is better
to use a graphic instead of a bitmap.
Thanks for the reply.
Can you provide me some sample code as how to use the custom renderer for drawing the colored square in front of the item name?