Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 SelectedLabel火花组合框_Actionscript 3_Apache Flex_Flex4.5 - Fatal编程技术网

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)