我确定这很容易,但我一直在寻找如何使用 actionscript 选择 DropDownList 元素。在这种情况下,我希望能够基于 ddlLabel 或 ddlData 指定 selectedItem
<?xml version="1.0" encoding="utf-8"?>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
[Bindable]
protected var timezonesArray:ArrayCollection = new ArrayCollection([
{ddlLabel:"Eastern Time", ddlData:"EST"},
{ddlLabel:"Central Time", ddlData:"CST"},
{ddlLabel:"Mountain Time", ddlData:"MST"},
{ddlLabel:"Pacific Time", ddlData:"PST"}
]);
protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
{
// I'm looking to select an element via actionscript here, based on ddlLabel or ddlData
}
]]>
</fx:Script>
<mx:Form>
<s:DropDownList id="ddlTimezones" dataProvider="{timezonesArray}" labelField="ddlLabel"/>
</mx:Form>