A component that displays a button, which may be pressed to open a list.

Create a data provider in MXML:

<js:DropDownList labelField="label">
            <fx:Object label="One"/>
            <fx:Object label="Two"/>
            <fx:Object label="Three"/>
            <fx:Object label="Four"/>
            <fx:Object label="Five"/>

The labelField specifies which property of the items will be displayed as text in the list's item renderers.

Listen for selection changes:

<js:DropDownList id="list" labelField="label" change="onChange(event)"/>
       private function onChange(event:Event):void
var selectedIndex:int = list.selectedIndex;
var selectedItem:Object = list.selectedItem;
trace("index:", selectedIndex);
trace("label:", selectedItem.label);
  • No labels