User Guide
CellRenderer.setValue() 127
If you want to enable the check box on the second row, you communicate through the data
provider. Any change to the data provider (when made through a DataProvider method such
as
DataProvider.editField()) calls setValue() to refresh the display of the grid. This
code would be written in the Flash application, either on a frame, on an object, or in another
class file (but not in the cell renderer class file):
// calls setValue() again
myGrid.editField(1, "enabled", true);
The following example loads an image in a loader component within the cell, depending on
the value passed:
function setValue(suggested, item, selected) : Void
{
/* Hide anything normally rendered in the cell if item is undefined.
Otherwise update the cell contents with the new data.
*/
if (item == undefined){
loader._visible = false;
}else{
// clear the loader
loader.contentPath = undefined;
// the list has URLs for different images in its data provider
if (suggested!=undefined){
loader.contentPath = suggested;
}
}
}
The following example is from a multiline text cell renderer:
function setValue(suggested:String, item:Object, selected:Boolean):Void
{
/* Hide anything normally rendered in the cell if item is undefined.
Otherwise update the cell contents with the new data.
*/
if (item == undefined){
multiLineLabel._visible = false;
}else{
// adds the text to the label
multiLineLabel.text = suggested;
}
}