Actionscript 3 SelectedLabel火花组合框
下面的函数返回要在项目呈现器中显示的字符串Actionscript 3 SelectedLabel火花组合框,actionscript-3,apache-flex,flex4.5,Actionscript 3,Apache Flex,Flex4.5,下面的函数返回要在项目呈现器中显示的字符串 public function itemToLabel(item:Object):String 由于selectedLabel属性在spark.components.ComboBox中已过时,我添加了此功能: public function get selectedLabel():String { var item:Object = selectedItem; return itemToLabel(item)
public function itemToLabel(item:Object):String
由于selectedLabel
属性在spark.components.ComboBox
中已过时,我添加了此功能:
public function get selectedLabel():String
{
var item:Object = selectedItem;
return itemToLabel(item);
}
但是关于公共函数集selectedLabel(label:String):void,我被阻止了
是否有人知道一个函数labelToItem
或另一个解决方案来设置我的组合框selectedLabel
不是最有效的解决方案,但是如果您在数据提供程序中没有大量项,那么这应该没问题:
public function setSelectedLabel(cb:ComboBox, label:String):void
{
for each(var item:Object in cb.dataProvider)
{
if(item[cb.labelField] == label)
{
cb.selectedItem = item;
return;
}
}
}
谢谢,我想这似乎是我需要的,但是你错过了我添加的actionScript的返回值(void)