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