PDA

View Full Version : Is it possible to know the column name of a datagrid column in Actionscript Class?


tanusree
10-01-2007, 01:15 PM
package {
import mx.controls.Label;
import mx.controls.DataGrid;
import mx.controls.dataGridClasses.DataGridListData;
import flash.display.Graphics;

public class CustomBackgroundComp extends Label
{
public static var vPrevOpen : string;

override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList (unscaledWidth, unscaledHeight);
var g:Graphics = graphics;



if (data[DataGridListData(listData).dataField] ="")
{
g.beginFill(0x000000);
g.drawRect(0, 0, unscaledWidth, unscaledHeight);
g.endfill();
}


else if (data[DataGridListData(listData).dataField] >= 1000
{
g.beginFill(0x009900);
g.drawRect(0, 0, unscaledWidth, unscaledHeight);
g.endFill();
}

else if (data[DataGridListData(listData).dataField] < 1000)
{
g.beginFill(0xFF0000);
g.drawRect(0, 0, unscaledWidth, unscaledHeight);
g.endFill();
}


}
}
}

Here using data[DataGridListData(listData).dataField], we can determine the data stored in a cell. Is it possible to know the column name in the Actionscript class.

If possible then how to do it?