User Guide

276 DataGrid component (Flash Professional only)
Usage
listenerObject = new Object();
listenerObject.cellFocusOut = function(eventObject){
// Insert your code here.
}
myDataGridInstance.addEventListener("cellFocusOut", listenerObject)
Description
Event; broadcast to all registered listeners whenever a user moves off a cell that has focus. You
can use the event object properties to isolate the cell that was left. This event is broadcast after
the
cellEdit event and before any subsequent cellFocusIn events are broadcast by the
next cell.
Version 2 components use a dispatcher/listener event model. When a DataGrid component
dispatches a
cellFocusOut event, the event is handled by a function (also called a handler)
that is attached to a listener object that you create. You call the
addEventListener() method
and pass it the name of the handler as a parameter.
When the event is triggered, it automatically passes an event object (
eventObject) to the
handler. Each event object has properties that contain information about the event. You can
use these properties to write code that handles the event. The
DataGrid.cellFocusOut
events event object has three additional properties:
columnIndex A number that indicates the index of the target column. The first position
is 0.
itemIndex A number that indicates the index of the target row. The first position is 0.
type The string "cellFocusOut".
For more information, see “EventDispatcher class” on page 499.
Example
In the following example, a handler called dgListener is defined and passed to
my_dg.addEventListener() as the second parameter. When the cellFocusOut 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;