28 Replies Latest reply on Jul 16, 2008 5:14 AM by Venian

    disable button

    Angel3m Level 1
      as my previous post Loading external movie on top of all layers

      i am facing a problem now that all the buttons are still working when the external movie loads on top.
      I want all the menu buttons to be disabled when the external movie loads and there is a CLOSE Button in the external movie. i tried to search for how to disable the buttons. i found some, but couldnt understand what to do.

      So any help will be appreciated here plz.

      Thnx in advance.

      Regards
        • 1. Re: disable button
          kglad Adobe Community Professional & MVP
          use use your buttons' _visible or enabled property.
          • 2. Re: disable button
            Angel3m Level 1
            thnx for reply kGlad

            may i know where to use these properties?
            sorry im not that familiar with terms that much...

            Thnx again
            • 3. Re: disable button
              kglad Adobe Community Professional & MVP
              you can use them just about anywhere that suits you. but it's best to attach code to a frame. in your case, you should attach it to a frame that contains your buttons and you should execute the code when you want to disable your buttons.

              for example, when you execute your loadMovie() (or loadMovieNum() or loadClip() statement), you can execute:

              btn1.enabled=false;
              btn2.enabled=false; // etc
              • 4. Re: disable button
                Angel3m Level 1
                hi,
                i did tried to put in the button code of my previous issue

                on (release) {
                // this.swapDepths(1);
                _root.createEmptyMovieClip("target_mc1",_root.getNextHighestDepth());
                _root.target_mc1._x = -600;
                _root.target_mc1._y = -150;
                _root.target_mc1.loadMovie("1.swf");
                security.enabled=false;
                }

                i can't add any more buttons to disable them
                like after
                security btn
                if i add
                development btn
                only
                security btn
                will be disabled... all other btnz will be working.
                i want like, on click all the buttons gets disabled and in the external movie clip, when i click the CLOSE btn, all buttons gets enabled.

                i found the following code.

                for (var name in this) {
                if (typeof (this[name]) == "movieclip") {
                for (var name1 in this[name]) {
                if (typeof (this[name][name1]) == "object") {
                this[name][name1].enabled = false;
                }
                }
                }
                }

                but i don't know the right place to add this code. though it works fine.
                disables all the btns with the name. again i wud like to put the structure of my file:

                1. main container of left and rite menu, single layer

                2. 2 layers. down layer -> right menu. up layer -> left.

                Now if we enter in right menu mc....

                3. animation of right menu

                4. in animation mc there are 4 buttons animation tweening

                5. button container with actionScript on button

                6. Button


                any ideas plz?

                • 5. Re: disable button
                  kglad Adobe Community Professional & MVP
                  is your security button disabled when you execute that code?
                  • 6. Re: disable button
                    Angel3m Level 1
                    yes, if the code is under On Release Action
                    • 7. Re: disable button
                      kglad Adobe Community Professional & MVP
                      and why can't you disable any more buttons?
                      • 8. Re: disable button
                        kglad Adobe Community Professional & MVP
                        and why can't you disable any more buttons?
                        • 9. Re: disable button
                          Angel3m Level 1
                          what can i say.... :(
                          is there any other way??


                          • 10. Re: disable button
                            kglad Adobe Community Professional & MVP
                            there are, almost always, many ways to get things done in all programming languages including actionscript. but you shouldn't give up on one way without some reason.

                            so, why can't you disable other buttons using the same technique used for your security button?
                            • 11. Re: disable button
                              Angel3m Level 1
                              well of course this is no the end

                              my friend, i really don't have any idea why its not working...

                              maybe we should try some other way.....
                              • 12. Re: disable button
                                kglad Adobe Community Professional & MVP
                                show the code that you used to try and disable your buttons.
                                • 13. Re: disable button
                                  Angel3m Level 1
                                  here is the code:

                                  on (release) {
                                  // this.swapDepths(1);
                                  _root.createEmptyMovieClip("target_mc1",_root.getNextHighestDepth());
                                  _root.target_mc1._x = -600;
                                  _root.target_mc1._y = -150;
                                  _root.target_mc1.loadMovie("1.swf");
                                  security.enabled=false;
                                  development.enabled=false;
                                  }
                                  • 14. Re: disable button
                                    kglad Adobe Community Professional & MVP
                                    do you have a button with instance name development that's on the same timeline as security and it fails to be disabled?
                                    • 15. Re: disable button
                                      Angel3m Level 1
                                      no ... all the buttons are on different time line... but in 1 mc

                                      • 16. Re: disable button
                                        kglad Adobe Community Professional & MVP
                                        then you need to use the correct path to the other buttons. what movieclip are the other buttons in? (and security is not in that movieclip?)
                                        • 17. Re: disable button
                                          Angel3m Level 1
                                          the exact structure is:
                                          scene -> Menu-Holder -> Rite-Menu -> Menu-Animation1 -> 001 -> btn-Security

                                          in Menu-Animation1 all the button movie Clips are on different layers, like 001, 002, 003 and 004...

                                          and btn-Security or btn-Development .... and so..... are in 001, 002......
                                          how shud the path will be? and where i suppose to put it?


                                          then you need to use the correct path to the other buttons. what movieclip are the other buttons in? (and security is not in that movieclip?)
                                          • 18. Re: disable button
                                            kglad Adobe Community Professional & MVP
                                            layers are irrelevant. but if your buttons are movieclip buttons and not simple buttons that is relevant. and no flash objects can have instance names like btn-Security.

                                            so, is that really supposed to be btn_Security or is that a library name and not an instance name?
                                            • 19. Re: disable button
                                              Angel3m Level 1
                                              btn_Security is a library name
                                              that is inside 001 movie clip
                                              and 001 instance name is Security

                                              wud u like to view the .fla file?
                                              • 20. Re: disable button
                                                kglad Adobe Community Professional & MVP
                                                library names are irrelevant for actionscript targeting and you can't have an object with instance name 001. so, i assume 001 is a library name which as i just mentioned is not helpful.

                                                is Security a simple button or a movieclip button?
                                                • 21. Re: disable button
                                                  Angel3m Level 1
                                                  Security is a movieclip button
                                                  • 22. Re: disable button
                                                    kglad Adobe Community Professional & MVP
                                                    is Security on the same timeline as the button that contains your code or is it in another movieclip and that (parent of Security) is on the same timeline as the button that contains your code?
                                                    • 23. Re: disable button
                                                      Angel3m Level 1
                                                      the code is on the security movieclip, not on the time frame.
                                                      • 24. Re: disable button
                                                        kglad Adobe Community Professional & MVP
                                                        i don't think i can help you without looking at your fla and doing the work for you. the things you're saying i have trouble understanding and you're not making progress understanding basic flash terminology as i explain it.
                                                        • 25. Re: disable button
                                                          Angel3m Level 1
                                                          here i ve uploaded the file. Plz download it:

                                                          http://www.adhabi.com/docs/menu.zip

                                                          Thank you
                                                          • 26. Re: disable button
                                                            kglad Adobe Community Professional & MVP
                                                            if you want to hire me to solve your problem send me an email via my website.
                                                            • 27. Re: disable button
                                                              Angel3m Level 1
                                                              Thnx kGlad

                                                              well, i have got the solution
                                                              i was putting the code in the main menu file.
                                                              but had to add in an external file. and here is the code

                                                              my_invisible_btn.useHandCursor = false;

                                                              thats all

                                                              Thnx everyone

                                                              Regards
                                                              • 28. Re: disable button
                                                                Venian Level 2
                                                                Better view the fla file. That idea is that from the code you showed us i understand that you put the actions on a button not on a frame.
                                                                You say you used:

                                                                on (release) {
                                                                } - this is used only when you click on the button in the stage and press F9 to add code directly to it. It isn't a good practice. Here for example you probably don't target right the movieclips if you set the actions in the button
                                                                you target a that second button as if it were inside the button that contains te code.

                                                                You should select a frame, from any layer (best the top layer), from inside the movieclip that contains all the buttons and press F9 to right the code there. Exemple:

                                                                security.onRelease = function {
                                                                // this.swapDepths(1);
                                                                _root.createEmptyMovieClip("target_mc1",_root.getNextHighestDepth());
                                                                _root.target_mc1._x = -600;
                                                                _root.target_mc1._y = -150;
                                                                _root.target_mc1.loadMovie("1.swf");
                                                                security.enabled=false;
                                                                development.enabled=false;
                                                                }