Mega Code Archive

 
Categories / Flex / Event
 

Get current target from event

<?xml version='1.0' encoding='UTF-8'?> <mx:Application      xmlns:s="library://ns.adobe.com/flex/spark"       xmlns:mx="http://www.adobe.com/2006/mxml">     <mx:Script>         import mx.controls.Alert;          public function showMsg(msg:String):void {              Alert.show(msg);          }     </mx:Script>     <mx:Panel width="400" height="150" title="Profile" horizontalCenter="0" verticalCenter="0">         <s:HGroup>             <mx:Label fontWeight="bold" text="Favorite car maker:" />             <s:DropDownList id="combo" close="showMsg('Value is ' + event.currentTarget.selectedItem)">                 <mx:ArrayCollection>                     <mx:String>A</mx:String>                     <mx:String>B</mx:String>                     <mx:String>C</mx:String>                 </mx:ArrayCollection>             </s:DropDownList>             <mx:Label fontWeight="bold" text="With the color of:" />             <mx:ColorPicker id="clr" change="showMsg('Color ' + event.currentTarget.selectedColor)" />         </s:HGroup>     </mx:Panel> </mx:Application>