To define a default label on a value object, just create a getter function named « label » that returns the appropriate field. The label property is the default labelField for most display controls such as the List, ComboBox. You can also create getters on your value objects that concatenate strings together such as first and last name. Just a little tip from me to you.
Here is a quick example. Enjoy.
public class UserVO{
public function UserVO(){
super();
}
public var nick_name : String;
public var first_name : String;
public var last_name : String;
// string together two fields with a getter
// use it as a label public function get full_name():String{
return first_name + " " + last_name;
}
// most controls will automatically pick this field up
// for display public function get label():String{
return full_name + " (" + this.nick_name + ")";
}
}
Comments