3 Replies Latest reply on Oct 16, 2010 1:03 PM by kglad

    Why I need to click it twice show buttons?




      First I don't see any buttons (Buttons -This is a movie clip) on Stage. When I click on Show button using the following code, I can see my Buttons. But first I need to click twice to see the Buttons. While second time there is no problem. How to solve the problem?


      this.Buttons.visible = false;
      import fl.controls.Button;


      var myButton:Button = new Button();
      myButton.label = "Show Menu";
      myButton.name = "btn1";
      myButton.toggle = true;
      myButton.move(55, 95);


      myButton.addEventListener(Event.CHANGE, changeHandler);


      function changeHandler (event:Event):void {
          if (event.currentTarget.selected == false) {
              Buttons.visible = true;
              myButton.label = "Hide Menu";
          } else {
              Buttons.visible = false;
              myButton.label = "Show Menu";       


      Thanks and regards,