User Guide
DataGrid.cellPress 277
// Create listener object.
var dgListener:Object = new Object();
dgListener.cellFocusOut = function(evt_obj:Object) {
var cell_str:String = "(" + evt_obj.columnIndex + ", " +
evt_obj.itemIndex + ")";
trace("The cell at " + cell_str + " has lost focus");
};
// Add listener.
my_dg.addEventListener("cellFocusOut", dgListener);
DataGrid.cellPress
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
listenerObject = new Object();
listenerObject.cellPress = function(eventObject){
// Insert your code here.
}
myDataGridInstance.addEventListener("cellPress", listenerObject)
Description
Event; broadcast to all registered listeners when a user presses the mouse button on a cell.
Version 2 components use a dispatcher/listener event model. When a DataGrid component
broadcasts a
cellPress event, the event is handled by a function (also called a handler) that is
attached to a listener object (
listenerObject) that you create. You call the
addEventListener() method and pass it the name of the handler as a parameter.
NOTE
The grid must be editable for this code to work, and the event is broadcast only for
editable cells. If you have two columns and only one of them is editable (for example,
"score"), clicking out of a row in the "name" column does not trigger this event.