User Guide
DataGrid.cellFocusOut 275
Example
In the following example, a handler called dgListener is defined and passed to
my_dg.addEventListener() as the second parameter. When the cellFocusIn event is
broadcast, a
trace statement is sent to the Output panel. With a DataGrid instance named
my_dg on the Stage, paste the following code in the first frame of the main timeline:
// Set up sample data.
var myDP_array:Array = new Array();
myDP_array.push({name:"Clark", score:3135});
myDP_array.push({name:"Bruce", score:403});
myDP_array.push({name:"Peter", score:25});
my_dg.dataProvider = myDP_array;
// Make DataGrid editable.
my_dg.editable = true;
// Create listener object.
var dgListener:Object = new Object();
dgListener.cellFocusIn = function(evt_obj:Object) {
var cell_str:String = "(" + evt_obj.columnIndex + ", " +
evt_obj.itemIndex + ")";
trace("The cell at " + cell_str + " has gained focus");
};
// Add listener.
my_dg.addEventListener("cellFocusIn", dgListener);
DataGrid.cellFocusOut
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
NOTE
The grid must be editable for this code to work, and the event is broadcast only for
editable cells. So if you have two columns and only one of them is editable (for example,
"score"), then clicking in a row in the "name" column would not trigger this event.