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