5 Replies Latest reply on Jul 6, 2014 7:32 PM by Phyle

    write function inside edge ?

    Phyle

      How do I write a function to "display Off" of some of my symbols, so that I can call this function when a button is pressed.

       

      Currently I am using this.

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

      Since I have many symbols to be turn off at once,  manually turning off individual symbol is not an option for me.

        • 1. Re: write function inside edge ?
          Phyle Level 1

          Any help?

          • 2. Re: write function inside edge ?
            Tim. Signore Level 1

            If I under stand your question, you can write a function just like you would in JavaScript/ jquery:

             

            function hideThings(){

            sym.$(.thingstohide).hide();

            }

             

            As you mentioned having to turn off many things at once, the above example assumes you have given them all a class of "thingstohide". To use this function, you just need to call it as the event handler in your button' s click event,

             

            $("button").on("click", hideThings);

             

            hope this helps

            • 3. Re: write function inside edge ?
              joel_pau Level 5

              Hi,

               

              If the elements [you want to hide] do not have the same class, here is one idea (2 implementations):

               

              1) Using Edge API:


              function hideAll(){ $.each( arguments,function(index,item){ sym.$(item).hide(); } ) };

              sym.setVariable("hideElements",hideAll);

               

              How to use?

              - Same panel code: hideAll("RoundRect","Text","Rectangle","Ellipse");

              - Another panel code but same symbol: sym.getVariable("hideElements")("RoundRect","Text","Rectangle","Ellipse");

              - Another symbol or timeline (triggers): sym.getComposition().getStage().getVariable("hideElements")("RoundRect","Text","Rectangle","E llipse");

               

              2) Extra API:

              I give up sym.setVariable() and sym.getVariable().


              sym.iHide = function (){ $.each( arguments, function(index,item){ sym.$(item).hide(); } ) };

               

              How to use?

              - Within same symbol: sym.iHide("RoundRect","Text","Rectangle");

              - Another symbol or timeline: sym.getComposition().getStage().iHide("RoundRect","Text","Rectangle");

               

              Note: you can replace .hide() by another jQuery function: .show(), .css(), etc.

              You can now hide [or show or change] a list of elements.

               

              I will add another idea tomorrow (Monday).

              1 person found this helpful
              • 4. Re: write function inside edge ?
                Phyle Level 1

                Thank you Tim!

                Can we write the function and button press on the stage time line?

                I tried this, but not alert, and no errors as well!

                 

                function testAlert(){

                alert("key pressed");

                }

                 

                $("button").on("click",testAlert);

                • 5. Re: write function inside edge ?
                  Phyle Level 1

                  Hi Joel,

                   

                  Thank you very much for your comprehensive reply! I am new to this, I will try to understand your method, your answers will be helpful for other advanced users for sure. Thank you very much!