Actionscript 3 如何在DropDownList中找到选中的项目?

Actionscript 3 如何在DropDownList中找到选中的项目?,actionscript-3,apache-flex,Actionscript 3,Apache Flex,这是资源的声明: public var langs:ArrayCollection = new ArrayCollection( [ {lab:"English"}, {lab:"Russian"}]); 这是dorpdownlist的声明: <s:DropDownList x="157.7" y="10.35" id="list" ></s:DropDownList> <s:TextArea x="15" y="38" width

这是资源的声明:

public var langs:ArrayCollection = new ArrayCollection(
        [ {lab:"English"},
        {lab:"Russian"}]);
这是dorpdownlist的声明:

<s:DropDownList x="157.7" y="10.35" id="list" ></s:DropDownList>
<s:TextArea x="15" y="38" width="255" height="277" id="textG"/>
<s:TextArea x="286" y="39" width="251" height="276" id="textT"/>
<s:Button x="465" y="322.65" label="Translate" click="button1_clickHandler(event)"/>
<s:DropDownList x="286.3" y="10.35" dataProvider="{langs}" labelField="lab" prompt="select"></s:DropDownList>


如何通过AS3查找在DropDownList上选择的项目?

您可以向用户提供一个id

我不确定,但是如果您遵循API,那么必须有一个名为
selectedIndex
的属性。因此,您可以从
数据提供程序
数组集合语言
获取项目
lang.getItemAt(dropDownlistID.selectedIndex)

您可以向提供id

我不确定,但是如果您遵循API,那么必须有一个名为
selectedIndex
的属性。因此,您可以从
数据提供程序
数组集合语言
获取项目
lang.getItemAt(dropDownlistID.selectedIndex)

它将是什么类型?我在声明的第一部分已经有了id。您最后的
s:DropDownList
没有
id
。它将是
Object
类型。它将是什么类型?我在声明的第一部分已经有了id。您最后的
s:DropDownList
没有
id
。它将是
对象类型
<s:DropDownList id="dropDownlistID" x="286.3" y="10.35" dataProvider="{langs}" 
                labelField="lab" prompt="select"></s:DropDownList>
dropDownlistID.selectedItem