Selected item and selected index from List : List Selection « Components « Flex






Selected item and selected index from List

Selected item and selected index from List
     
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import flash.events.Event;
        public function changeEvt(event:Event):void {
            log.text=event.currentTarget.selectedItem.label + " " + event.currentTarget.selectedIndex;
        }
      
    </mx:Script>
    <mx:List width="35" change="changeEvt(event)">
        <mx:Object label="A" data="aa" />
        <mx:Object label="B" data="bb" />
        <mx:Object label="C" data="cc" />
    </mx:List>
    <mx:TextArea id="log" width="150" />
</mx:Application>

   
    
    
    
    
  








Related examples in the same category

1.Using binding to capture the selection of a List-based componentUsing binding to capture the selection of a List-based component
2.Set List selected itemSet List selected item
3.Set selected index for ListSet selected index for List
4.Set selection color for ListSet selection color for List
5.Spark List Selection change listenerSpark List Selection change listener
6.Enable multiple selection for the List controlEnable multiple selection for the List control