Delete button controls by pressing the mouse button and hold Shift key : Button Event « Components « Flex






Delete button controls by pressing the mouse button and hold Shift key

Delete button controls by pressing the mouse button and hold Shift key
        

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    creationComplete="initApp()">
    <mx:Script>
    import mx.controls.Button;
    private function initApp():void {
        var b1:Button = new Button();
        var b2:Button = new Button();
        b1.addEventListener(MouseEvent.CLICK, removeButtons);
        b2.addEventListener(MouseEvent.CLICK, removeButtons);
        addChild(b1);
        addChild(b2);
    }
    private function removeButtons(event:MouseEvent):void {
        if (event.shiftKey) {
            removeChild(Button(event.currentTarget));
        } else {
            event.currentTarget.toolTip = "hold shiftkey down and click to delete this button.";
        }
    }
  </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 AddEventListener methodButton AddEventListener method
24.Button Click eventButton Click event
25.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
26.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
27.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
28.Use the pause() and play() methods in event listener for two Button controls to pause or play an FLV file
29.Handle a Button's Click EventHandle a Button's Click Event
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