DataGrid.columnStretch

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX Professional 2004.

Usage

listenerObject = new Object();
listenerObject.columnStretch = function(eventObject){
    // Insert your code here.
}
myDataGridInstance.addEventListener("columnStretch", listenerObject)

Description

Event; broadcast to all registered listeners when a user resizes a column horizontally.

Components use a dispatcher/listener event model. When a DataGrid component dispatches a columnStretch 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.

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.columnStretch event's event object has two additional properties:

columnIndex A number that indicates the index of the target column. The first position is 0.

type The string "columnStretch".

For more information, see EventDispatcher class.

Example

The following example displays the column index number in the Output panel when the title is resized. With a DataGrid instance named my_dg on the Stage, paste the following code in the first frame of the main timeline:

my_dg.setSize(240, 100);

// Set up sample data.
var myDP_array:Array = new Array();
myDP_array.push({id:0, name:"Clark", score:3135});
myDP_array.push({id:1, name:"Bruce", score:403});
myDP_array.push({id:2, name:"Peter", score:25});

my_dg.dataProvider = myDP_array;

// Create listener object.
var dgListener:Object = new Object();
dgListener.columnStretch = function(evt_obj:Object) {
    trace("column " + evt_obj.columnIndex + " was resized");
};

// Add listener.
my_dg.addEventListener("columnStretch", dgListener);