Accesses Button id that triggered the event : Button Event « Components « Flex






Accesses Button id that triggered the event

Accesses Button id that triggered the event
        

<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1) proper attribution to Adobe is given as the owner of the user guide; and 
  (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->



<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:s="library://ns.adobe.com/flex/spark">
    <fx:Script>
         
        import mx.controls.Alert; 
        private function myEventHandler(e:Event):void { 
            Alert.show("The button '" + e.currentTarget.id + "' was clicked."); 
        } 
      
    </fx:Script>
    <s:Button id="b1" label="Click Me" click="myEventHandler(event)" />
</s:Application>

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.Check to see if button has certain type of eventCheck to see if button has certain type of event
2.Embed calculation logic into Button click eventEmbed calculation logic into Button click event
3.Add event listener function to Button with ActionScriptAdd event listener function to Button with ActionScript
4.Specify a listener function for the Button control's click eventSpecify a listener function for the Button control's click event
5.Access button id that triggered the eventAccess button id that triggered the event
6.Define a handler function, register it for click event of the Button controlDefine a handler function, register it for click event of the Button control
7.Add addEventListener() inline with Button's initialize propertyAdd addEventListener() inline with Button's initialize property
8.Dispatch a Button control's click event, without clicking a ButtonDispatch a Button control's click event, without clicking a Button
9.When clicking a Button control, the Button control dispatches a click eventWhen clicking a Button control, the Button control dispatches a click event
10.RadioButton click event handlerRadioButton click event handler
11.itemClick event for group tells which button was selecteditemClick event for group tells which button was selected
12.Define an event listener for the Button controlDefine an event listener for the Button control
13.Link button click eventLink button click event
14.Set Button click event handler method with both ActionScript and MXMLSet Button click event handler method with both ActionScript and MXML
15.Change state in button click eventChange state in button click event
16.Button click property contains event listenerButton click property contains event listener
17.Use addEventListener() method to register different buttons to same handler functionUse addEventListener() method to register different buttons to same handler function
18.Set Button event handler with SetEventHandlerSet Button event handler with SetEventHandler
19.Call web service in Button click event handler
20.preinitialize, initialize, creationComplete events for Button controlpreinitialize, initialize, creationComplete events for Button control
21.Use button click event to update Label textUse button click event to update Label text
22.Button AddEventListener methodButton AddEventListener method
23.Button Click eventButton Click event
24.When a user selects a RadioButton control, Flex calls the event handler associated with that button's click eventWhen a user selects a RadioButton control, Flex calls the event handler associated with that button's click event
25.To set functionality such as a single event handler on the group, use the tagTo set functionality such as a single event handler on the group, use the <s:RadioButtonGroup> tag
26.itemClick event listener for the group can take a different action depending on which button was selecteditemClick event listener for the group can take a different action depending on which button was selected
27.Use the pause() and play() methods in event listener for two Button controls to pause or play an FLV file
28.Handle a Button's Click EventHandle a Button's Click Event
29.Delete button controls by pressing the mouse button and hold Shift keyDelete button controls by pressing the mouse button and hold Shift key
30.Specify listener function in the click attribute of the Specify listener function in the click attribute of the <mx:Button>
31.Define a function that logs the various stages of the Button control's startup life cycleDefine a function that logs the various stages of the Button control's startup life cycle