5 Replies Latest reply: Nov 8, 2014 10:38 AM by smenegassi RSS

    Bind actions

    smenegassi Community Member

      And a second question...

      Can I bind actions (clicks, rollover...) on buttons on Composition Ready ? If so, how to do it ?

      I am thinking of AS3 where you put all code together at the same place.

       

      Thanks again

        • 1. Re: Bind actions
          vivekuma Adobe Employee

          You can bind elements to a list of events, first you need to select the element on which you need to listen for events and then click on the {} button as shown in the pic below:

               bind.png

          hth,

          Vivekuma

          • 2. Re: Bind actions
            smenegassi Community Member

            Hi,

            My question was how to bind buttons actions directly from the Stage. It could avoid the problem I exposed on my earlier question : DIVS and Symbols

            • 3. Re: Bind actions
              joel_pau CommunityMVP

              Hi,

               

              You can script as above:

              1) an element: sym.$("Rectangle").bind("click", function(){ doSomething() });

              2) a class: sym.$(".red").bind("click", function(){ doSomething() });

              See : jQuery> .bind()

              You can also use symbols.

              • 4. Re: Bind actions
                vivekuma Adobe Employee

                Ok, so lets say stage contains "Symbol_1" which further contains "Symbol_2" which further contains a div element say "Ellipse", then try adding the below code in the stage compositionReady like:

                     sym.getSymbol("Symbol_1").getSymbol("Symbol_2").$("Ellipse").click(function(){

                       console.log("Clicked!!!");

                     });

                 

                hth,

                Vivekuma

                • 5. Re: Bind actions
                  smenegassi Community Member

                  Great!  thank you vivekuma and joel pau. That is exactly what I wanted to know.