User Guide

CellRenderer.getPreferredWidth() 121
This example returns a value that is 4 pixels less that the height of the row:
function getPreferredHeight():Number
{
/* You know the cell is given a property, "owner", which is the row. It’s
always preferred for the cell to take up most of the row's height.
*/
return owner.__height - 4;
}
CellRenderer.getPreferredWidth()
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
componentInstance.getPreferredWidth()
Parameters
None.
Returns
A value (of type Number) that indicates the correct width of the cell.
Description
Method; the preferred width of a cell. If you specify a width greater than that of the
component, the cell may be cut off.
Implement this method for the Menu component. Your cell is sized to whatever the width of
the row is, except in a menu, which must measure the text for the width of the row. You can
also implement this method for the DataGrid component where the header renderer checks
whether or not to show the sort arrow.