Get event type, event target and event target id : Event Target « Event « Flex






Get event type, event target and event target id

Get event type, event target and event target id
           

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    
        private function clickHandler(evt:Event):void
        {
            myText.text="button clicked";
            myText.text+= "Event type: " + evt.type;
            myText.text+= "Event Target: " + evt.target; 
            myText.text+= "Event Target ID: " + evt.target.id; 
        }
  
    </mx:Script>
    <mx:Panel title="Using the Event Object" width="240" height="282">
        <mx:TextArea width="100%" height="100%"
            id="myText" text="click something please !"/>
        <mx:HBox>           
            <mx:Button id="myButton" 
                label="Click Me" 
                click="clickHandler(event)"/>
        </mx:HBox>
    </mx:Panel>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Get current target from eventGet current target from event
2.Pass current event target text to functionPass current event target text to function
3.Get event target labelGet event target label
4.Display current phase and information about the current targetDisplay current phase and information about the current target
5.Display the current phase and current target's IDDisplay the current phase and current target's ID
6.Use the target property not currentTarget propertyUse the target property not currentTarget property
7.Event target idEvent target id
8.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.
9.Check event current target class nameCheck event current target class name
10.Check event target id
11.Let current event target show the drop feedbackLet current event target show the drop feedback