2 Replies Latest reply on May 28, 2010 10:56 AM by Rdsingh Ldh

    How do I disable an event handler?

    SiHoop Level 1

      The file below contains a canvas and a button on the canvas. There are two event handlers, one for the button and one for the canvas. How to I disable the event handler for the canvas when the button is clicked?


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
                  public function init():void{
                      canvas.addEventListener(MouseEvent.CLICK, handleClick)               
                      button.addEventListener(MouseEvent.CLICK, handleButtonClick)
                  public function handleClick(e:Event):void{
                      trace("Application clicked")
                  public function handleButtonClick(e:Event):void{
                      trace("Button clicked")
          <mx:Canvas  id="canvas" x="108" y="82" width="200" height="200"  backgroundColor="0xff0000">
              <mx:Button  id="button" x="10" y="168" label="Button" mouseChildren="false"/>