런타임 버전: | Flash Player 10, AIR 2.0 |
This interface provides a method that dynamically created visual
elements can use to configure themselves before they're displayed.
It's called as needed when a factory generated visual element
is created or reused. It is not intended to be called directly.
This is an optional interface for all of the factory-generated
visual elements except itemRenderers: caretIndicator
,
hoverIndicator
, editorIndicator
,
selectionIndicator
, columnSeparator
,
rowSeparator
,
alternatingRowColorsBackground
(see DataGrid),
sortIndicator
(see GridColumnHeaderGroup). It's
typically used to configure generated visual elements with
DataGrid's style values. For example, to use the value of the
DataGrid's "symbolColor" style for the caret's fill color,
one would define the prepareGridVisualElement()
method like this:
public function prepareGridVisualElement(grid:Grid, rowIndex:int, columnIndex:int):void
{
caretStroke.color = grid.dataGrid.getStyle("caretColor");
}
The rowIndex
and columnIndex
parameters specify the
the cell the visual element will occupy. If columnIndex
= -1 then the visual element
occupies a Grid row. If rowIndex
= -1 then the visual element occupies
a Grid column.
There are many more examples like this in DataGridSkin.mxml. Note that custom
DataGrid skin visual elements can choose not to implement this interface if the
the added flexibility isn't needed.