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.
You need to implement this method only for the Menu component. Your cell will be sized to
whatever the width of the row is, except in a menu, which must measure the text for the width of
the row.
Example
This example returns the value 3, which indicates that the cell should be three times bigger than
the length of the string it is rendering:
function getPreferredWidth():Number
{
return myString.length*3;
}
This example comments out the
// function getPreferredWidth :: only really necessary for a menu
CellRenderer.listOwner
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX 2004.
Usage
componentInstance.listOwner
Description
Property; a reference to the list that owns the cell. That list can be a DataGrid, Tree, List, or Menu
component.
This method is provided by the List class; you do not have to implement it. Declare it in your cell
renderer class as follows, and use it as a reference back to the list (or tree, menu, or grid):
var listOwner:MovieClip; // or UIObject, etc.
Example
This example finds the list's selected item in a cell:
var s = listOwner.selectedItem;
152
Chapter 6: Components Dictionary
getPreferredWidth()
method:
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?