Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
spark.utils 
LabelUtil 
Packagespark.utils
Classpublic class LabelUtil
InheritanceLabelUtil Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

The LabelUtil class is used by components to determine the correct text to display for their renderers or sub-parts.



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined By
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
itemToLabel(item:Object, labelField:String = null, labelFunction:Function = null):String
[static] A function used by components that support item renderers to determine the correct text an item renderer should display for a data item.
LabelUtil
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Method Detail

itemToLabel

()method
public static function itemToLabel(item:Object, labelField:String = null, labelFunction:Function = null):String

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

A function used by components that support item renderers to determine the correct text an item renderer should display for a data item. If no labelField or labelFunction parameter is specified, the toString() method of the data item is called to return a String representation of the data item.

The labelFunction property takes a reference to a function. The function takes a single argument which is the item in the data provider and returns a String:

      myLabelFunction(item:Object):String

Parameters

item:Object — The data item. Null items return the empty string.
 
labelField:String (default = null) — The field in the data item to return.
 
labelFunction:Function (default = null) — A function that takes the data item as a single parameter and returns a String.

Returns
String — A String representation for the data item