4 Replies Latest reply on May 17, 2007 9:04 AM by Rothrock

    disabling everything clickable

    Damon Edwards Level 3
      how can i disable everything clickable once a movie clip starts to play..say the movie clip is called movie_mc, and its playing on top of a lot of other information, i dont want the user to be able to click anything in the background.. so how would i disable anything clickable??
        • 1. Re: disabling everything clickable
          Rothrock Level 5
          Well if you've put everything on the stage you can keep track of them and then go through and set myClip.enabled=false;

          If you aren't sure of how many things are on the stage, just use a for…in loop to look through everything and if it has an enabled property set it to false.

          Generally I make it a function like disableButtons() or some such. Sometimes I want to keep the one thing I'm interacting with useable, so in that case I pass it to the function, disable everything and then enable the one I passed.

          Without know exactly what you got it is hard to be more specific. But remember having a well organized approach is the first step.
          • 2. Re: disabling everything clickable
            Damon Edwards Level 3
            so i could just add something like this to my actions layer
            my_btn.onRelease = function() {
            button1_btn.enabled=false;
            button2_btn.enabled=false;
            movie1_mc.enabled=false;
            movie2_mc.enabled=false;
            }
            • 3. Re: disabling everything clickable
              Damon Edwards Level 3
              tried it, and it worked like magic. thanks
              • 4. Re: disabling everything clickable
                Rothrock Level 5
                The short answer is yes. The long answer is it is better to make it a function so that it is all in one place and easier to maintain.

                my_btn.onRelease=function(){
                disableAll();
                }

                function disableAll(){
                button1_btn.enabled=false;
                button2_btn.enabled=false;
                movie1_mc.enabled=false;
                movie2_mc.enabled=false;
                }

                And don't forget that you will probably want to enable them again in the future.

                function enableAll(){
                button1_btn.enabled=true;
                button2_btn.enabled=true;
                movie1_mc.enabled=true;
                movie2_mc.enabled=true;
                }

                But you can clearly see that you might add another button. You remember to put it in the disable function but then forget to put it in the enable, or perhaps you make a typo in one or the other. Instead perhaps push all the things into an array and then just step through the array to enable and disable.

                The ways to do it are endless and you will discover more as you go.