Determine drag proxy when using itemRenderer on DataGrid
I'm using default drag/drop on Flex DataGrid, however, the dataGrid itself has an itemrenderer. Looks like:
public class FlashFileDataGridRenderer extends 开发者_开发百科Label{
public function FlashFileDataGridRenderer(){
super();
}
override protected function updateDisplayList (unscaledWidth:Number, unscaledHeight:Number):void {
super.updateDisplayList(unscaledWidth, unscaledHeight);
this.setStyle("paddingLeft", "3");
if (data instanceof FlashEntryBean) {
if ((data.cutFlag)) {
setStyle("color", "#AAAAAA");
}
else
setStyle("color", "#000000");
}
That's applied to all items in the datagrid. This no longer shows the proxy with lower alpha when being dragged. I want to be able to retain that style, how can I determine if this particular item is being applied itemrenderer. I am thinking if I can determine if the object is a proxy, then fade the text myself.
Thanks!
Try moving the setStyle calls to the overriden set data method
override public function set data(t:Object):void
{
super.data = t;
if (data instanceof FlashEntryBean) {
if (data.cutFlag)
setStyle("color", "#AAAAAA");
else
setStyle("color", "#000000");
}
}
Not sure which SDK version you're using but in 3.5 it certainly does retain grayish text color in dragged proxy.
精彩评论