Example
The following example sets the
"Nina" would display as the label for the item added in the second line of code:
var my_list:mx.controls.List;
my_list.labelField = "name";
my_list.addItem({name: "Nina", age: 25});
See also
List.labelFunction
List.labelFunction
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
listInstance.labelFunction
Description
Property; specifies a function that determines which field (or field combination) of each item
to display. This function receives one parameter,
must return a string representing the text to display.
Example
The following example makes the label display some formatted details of the items:
var my_list:mx.controls.List;
my_list.setSize(300, 100);
// Define how list data will be displayed.
my_list.labelFunction = function(item_obj:Object):String {
var label_str:String = item_obj.label + " - Code is: " + item_obj.data;
return label_str;
}
// Add data to list.
my_list.addItem({data:"f", label:"Flash"});
my_list.addItem({data:"d", label:"Dreamweaver"});
my_list.addItem({data:"c", label:"ColdFusion"});
790
List component
property to be the
labelField
item
field of each item.
"name"
, which is the item being rendered, and
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers