Convert event target to List control : List Event « Components « Flex






Convert event target to List control

Convert event target to List control
           

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    
    <mx:Script>
        
            import mx.controls.List;
            import mx.controls.Alert;
            
            private function handleChangeEvent(event:Event):void
            {
                Alert.show("selected: " + List(event.currentTarget).selectedItem.label);
            }
            
      
    </mx:Script>
    
    <mx:List change="handleChangeEvent(event)">
        <mx:dataProvider>
            <mx:Array>
                <mx:Object label="A" />
                <mx:Object label="B" />
                <mx:Object label="C" />
            </mx:Array>
        </mx:dataProvider>
    </mx:List>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Change event for List controlChange event for List control
2.Adding an event listener if one isn't presentAdding an event listener if one isn't present
3.Event listener in an ActionScript function in an tagEvent listener in an ActionScript function in an <mx:Script> tag
4.List change eventList change event
5.Get selected item from a list from change eventGet selected item from a list from change event
6.Write your event listener to access the event objectWrite your event listener to access the event object
7.A data-binding watcher invokes an event listener when a binding occurs.A data-binding watcher invokes an event listener when a binding occurs.
8.List dragOver, dragDrop, dragExit eventsList dragOver, dragDrop, dragExit events
9.List double click eventList double click event
10.Add an Event Listener in MXMLAdd an Event Listener in MXML