Trigger the drop down of DropDownList : DropDownList « Components « Flex






Trigger the drop down of DropDownList

Trigger the drop down of DropDownList
           

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:s="library://ns.adobe.com/flex/spark"            
               >
    <mx:Script>
        
            import mx.events.FlexEvent;
            
            import spark.events.IndexChangeEvent;
            [Bindable]
            protected var seasonLabel:String;

            protected function buttonClickHandler(event:MouseEvent):void {
                myDropDown.openDropDown();
            }

            protected function seasonChangeHandler(event:IndexChangeEvent):void {
                seasonLabel = seasonsData.getItemAt(event.newIndex).label as String;
            }
            
            protected function keyPressHandler(event:KeyboardEvent):void{
  //              if(event.keyCode == 83 && event.altKey){
                    myDropDown.setFocus();
                    myDropDown.openDropDown();
    //            }
            }
      
    </mx:Script>

    <mx:ArrayCollection id="seasonsData">
            <mx:Object label="Winter"/>
            <mx:Object label="Spring"/>
            <mx:Object label="Summer"/>
            <mx:Object label="Fall"/>
    </mx:ArrayCollection>
    <mx:TextInput id="textInput" keyDown="keyPressHandler(event)"/>
    <s:DropDownList id="myDropDown" dataProvider="{seasonsData}" change="seasonChangeHandler(event)"/>
    <mx:Label text="{seasonLabel}"/>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Fill ArrayCollection to a DropDownListFill ArrayCollection to a DropDownList
2.Get current selected value from DropDownListGet current selected value from DropDownList
3.Enable a Group by checking a DropDownList selectionEnable a Group by checking a DropDownList selection
4.DropDownList control with prompt messageDropDownList control with prompt message