2 Replies Latest reply: Oct 16, 2012 4:32 AM by Ned Murphy RSS

    How to properly disable a button after click or can an event disable itself?

    nikolaig Community Member

      Can I disable  MouseEvent.CLICK after I clicked it?

      I am relatively new to coding and it seems to me as a mistake that an event will disable itself?

      Is it ok or is it prone to some mistakes?

       

      mainNav_buttonsGroup_mc.Products_btn_mc.addEventListener(MouseEvent.CLICK, onClick_Products_btn);

       

       

                function onClick_Products_btn(event:MouseEvent) :void {

                          gotoAndPlay("products");

       

                          mainNav_buttonsGroup_mc.Products_btn_mc.removeEventListener(MouseEvent.CLICK, onClick_Products_btn);

       

        Products_btn_timeLine.play();

                          }

       

       

      The idea is that I want to disable a button after it is clicked.