Get current target from event : Event Target « Event « Flex






Get current target from 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>

   
    
    
    
    
    
  








Related examples in the same category

1.Pass current event target text to functionPass current event target text to function
2.Get event target labelGet event target label
3.Display current phase and information about the current targetDisplay current phase and information about the current target
4.Display the current phase and current target's IDDisplay the current phase and current target's ID
5.Use the target property not currentTarget propertyUse the target property not currentTarget property
6.Event target idEvent target id
7.Use Event object to access methods and properties of the target component, or the component that dispatched the event.Use Event object to access methods and properties of the target component, or the component that dispatched the event.
8.Check event current target class nameCheck event current target class name
9.Get event type, event target and event target idGet event type, event target and event target id
10.Check event target id
11.Let current event target show the drop feedbackLet current event target show the drop feedback