2 Replies Latest reply on Oct 28, 2016 12:47 PM by joel_pau

    Apply rollover effect to multiple objects.

    nated78203888

      I'm looking for an easier way to apply rollover effects (different states for symbols) to multiple symbols at once. I know how to do this to each individual symbol but I'm wondering if there's a faster way to apply the effect to multiple symbols.

        • 1. Re: Apply rollover effect to multiple objects.
          resdesign Adobe Community Professional & MVP

          Give them  a class name. example calls myIcons

          use in compositionReady.

           

          sym.$(".myIcons").bind('mouseenter",function(){

          // do something

          });

           

           

          Make sure you have the period before the class name!!!

          • 2. Re: Apply rollover effect to multiple objects.
            joel_pau Level 5

            Hi,

             

            You can also use:  sym.getComposition().getSymbols("symbolName");

             

            For example:

            The library panel has a symbol named "Button".

            All buttons require a click event.

            sym.getComposition().getSymbols("Button").forEach( function(item){

                console.log( item );

                item.getSymbolElement().bind( "click", function(e){ console.log( e.target + " has been clicked"); });

            });

             

            Now, if the goal of the click event is to play a label.

            sym.getComposition().getSymbols("Button").forEach( function(item){

                 item.getSymbolElement().bind( "click", function(){ item.play("aLabel"); });

            });

             

            A sample: button events.zip - Box