2 Replies Latest reply on Oct 8, 2014 1:35 AM by ianloh123

    How to disable/enable other buttons when one is active?

    ianloh123 Level 1

      Hi community!

       

      I have numerous symbols which animate in when clicked and out when clicked again one at a time. Thx again to vivekuma who helped me materialize this.

       

      But then i realized i also need to disable the other symbols when one is active and re-enable them when it animates back out like in the sample. I won't hold it against anyone for laughing, but I was trying to combine this bind/unbind with this current var method but it's mostly blind shot after blind shot

       

      Any help would be greatly appreciated!

        • 1. Re: How to disable/enable other buttons when one is active?
          vivekuma Adobe Employee

          Hi,

           

          Use the below code:

               1. In compositionReady handler:

                    Add:

                         sym.$(".elf").hide();

                         sym.setVariable("count", 200);

           

                         this.checkIfActiveSymbol = function(childSym){

                           var bActiveSymbol = sym.getVariable("symName");

                           if(bActiveSymbol && (bActiveSymbol != childSym.name))

                                return false;

                           return true;

                         }

           

                         this.setActiveSymbol = function(childSym) {

                              var bActiveSymbol = sym.setVariable("symName", childSym.name);

                         }

           

                         this.resetActiveSymbol = function() {

                              var bActiveSymbol = sym.setVariable("symName", "");

                         }

           

               2. For click handler for each btn symbol:

                    Replace: use btn1 and btn accordingly for each button symbol.

                         var childSym = sym.getSymbol("btn1");

                         var pos = childSym.getPosition();

           

                         if(!sym.checkIfActiveSymbol(childSym))

                           return;

           

                         if (pos < 499) {

                           sym.setActiveSymbol(childSym);

                           sym.getSymbol("btn1").play("1");

                           sym.getSymbol("btn1").$("name").fadeToggle();

                           sym.getSymbol("btn1").$("mailbtn").fadeToggle();

                         }

           

                         if (pos > 501) {

                           sym.resetActiveSymbol();

                           sym.getSymbol("btn1").playReverse(pos);

                           sym.getSymbol("btn1").$("name").fadeToggle();

                           sym.getSymbol("btn1").$("mailbtn").fadeToggle();

                         }

           

                         var count = sym.getVariable("count");

                         sym.getSymbol("btn1").getSymbolElement().css({"z-index":count});

                         sym.setVariable("count", count+1);

           

          hth,

          Vivekuma

          • 2. Re: How to disable/enable other buttons when one is active?
            ianloh123 Level 1

            yup that did the trick, n then some...

             

            I will learn from this, vivekuma! ur help is not in vain!