Button AddEventListener method : Button Event « Components « Flex






Button AddEventListener method

Button AddEventListener method
        
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initApp(event);">
    <mx:Button id="btn" label="Show Names"/>

    <mx:Script>
        
            import mx.events.FlexEvent;

            private function initApp(evt:FlexEvent):void
            {
                btn.addEventListener(MouseEvent.CLICK,showNames);
                btn.addEventListener(MouseEvent.CLICK,showTitles);
            }

            private function showNames(evt:MouseEvent):void
            {
                var temp:Array = new Array("A","B","C","D");
                trace(temp.toString());
            }

            private function showTitles(evt:MouseEvent):void
            {
                var temp:Array = new Array("Director","Vice-President","President","CEO");
                trace(temp.toString());
            }
      
    </mx:Script>
</mx: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.Accesses Button id that triggered the eventAccesses Button id that triggered the event
18.Use addEventListener() method to register different buttons to same handler functionUse addEventListener() method to register different buttons to same handler function
19.Set Button event handler with SetEventHandlerSet Button event handler with SetEventHandler
20.Call web service in Button click event handler
21.preinitialize, initialize, creationComplete events for Button controlpreinitialize, initialize, creationComplete events for Button control
22.Use button click event to update Label textUse button click event to update Label text
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