7 Replies Latest reply on Oct 3, 2012 5:53 AM by kberle123

    Forcing a symbol within a symbol to play out when a button on the main timeline is clicked?

    kberle123

      I have a buttons that play to symbols on the timeline. Once another button is clicked on the timeline the symbol will playout then start playing the next symbol. This is the code used on the onClick event on the introduction button.

       

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

         if (current != "") {

            sym.getSymbol(current).play("out");

            sym.getSymbol("intro").play("in");

         }

         else {

            sym.getSymbol("intro").play("shortIn");

         }

         sym.setVariable("current", "intro");

       

      The problem I'm having is with the technology symbol. I have buttons within this symbol that link to other symbols. I would like these symbols to playout like the other buttons, but the content of the symbol stays on the stage and does not play out when I select a button on the Stage. Here is the code I have on the click event on the button within the symbol.

       

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

         if (current2 != "") {

            sym.getSymbol(current2).play("out");

            sym.getSymbol("optical1").play("in");

         }

         else {

            sym.getSymbol("optical1").play("shortIn");

         }

         sym.setVariable("current2", "optical1");

       

      Any help would be greatly appreciated. Thank you very much!

        • 1. Re: Forcing a symbol within a symbol to play out when a button on the main timeline is clicked?
          kberle123 Level 1

          I have found a solution. But it would require me to add the code in bold to every button on the stage for every button within the symbol. I'm not sure if there is an easier or better way.

           

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

             if (current != "") {

                sym.getSymbol(current).play("out");

                sym.getSymbol("spec").play("in");

             }

             else {

                sym.getSymbol("spec").play("shortIn");

             }

             sym.setVariable("current", "spec");

            

             var optical1 = sym.getSymbol("tech").getSymbol("optical1")

                   if (current = "optical1") {

                      sym.getSymbol("tech").getSymbol("optical1").play("out");

                   }

          • 2. Re: Forcing a symbol within a symbol to play out when a button on the main timeline is clicked?
            kberle123 Level 1

            Now I'm running into the issue that every button on the stage is running the out symbols within the symbol upon mouse click.

            • 3. Re: Forcing a symbol within a symbol to play out when a button on the main timeline is clicked?
              resdesign Adobe Community Professional & MVP

              The API says:

              Access a symbol timeline from within another symbol

              To access another symbol element from within a symbol, prefix the getSymbol call with sym.getComposition().getStage(), as the following example shows:

                // Get the stage from the composition level, get the symbol, and play the timeline
              sym.getComposition().getStage().getSymbol("symbolName").play();
               

              To access a nested symbol timeline from within a symbol, nest the getSymbol call, as the following example shows:

                // Get the stage from the composition level, get the parent symbol, then get the nested symbol timeline
              sym.getComposition().getStage().getSymbol("symbolName1").getSymbol("symbolName2").play(0);
               

              You can access elements from within a symbol timeline from within another symbol. For example:

              // Get the symbol element "kitten_1" and hide the element "kitten_paw"
              sym.getComposition().getStage().getSymbol("kitten_1").$("kitten_paw").hide();
                 

              Access a nested symbol timeline from the main stage

              To access the timeline of a nested symbol, use the following in your event:

                sym.getSymbol("symbolName").getSymbol("nestedElementName").play(); 

              You can also access elements within a nested symbol from the stage. For example:

                // Hide the element "paw" from within a nested symbol
              sym.getSymbol("kitten_1").getSymbol("kitten_paw").$("paw").hide();
                  

              Access a nested symbol timeline from another symbol

              To access the timeline of a nested symbol from another symbol, use the following in your event:

                sym.getComposition().getStage().getSymbol("symbolName").getSymbol("nestedElementName").play(); 

              You can also access elements within a nested symbol from the stage. For example:

                // Hide the element "paw" from within a nested symbol
              sym.getComposition().getStage().sym.getSymbol("kitten_1").getSymbol("kitten_paw").$("paw").hide();

              • 4. Re: Forcing a symbol within a symbol to play out when a button on the main timeline is clicked?
                kberle123 Level 1

                Thank you very much for responding so quickly! When I do this all of the nested timelines play from the out label on their timeline. I want the one that is currently being viewed to be the only one that plays out, not all of the symbols within the symbol. Here is the code I'm using on the buttons on the main timeline:

                 

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

                   if (current != "") {

                      sym.getSymbol(current).play("out");

                      sym.getSymbol("spec").play("in");

                   }

                   else {

                      sym.getSymbol("spec").play("shortIn");

                   }

                   sym.setVariable("current", "spec");

                 

                   var techSym1 = sym.getSymbol("tech").getSymbol("techSym1")

                         if (current = "techSym1") {

                            sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym1").play("out");

                         }

                   var techSym2 = sym.getSymbol("tech").getSymbol("techSym2")

                         if (current = "techSym2") {

                            sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym2").play("out");

                         }

                   var techSym3 = sym.getSymbol("tech").getSymbol("techSym3")

                         if (current = "techSym3") {

                            sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym3").play("out");

                         }

                   var techSym4 = sym.getSymbol("tech").getSymbol("techSym4")

                         if (current = "techSym4") {

                            sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym4").play("out");

                         }

                   var techSym5 = sym.getSymbol("tech").getSymbol("techSym5")

                         if (current = "techSym5") {

                            sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym5").play("out");

                         }

                   var techSym6 = sym.getSymbol("tech").getSymbol("techSym6")

                         if (current = "techSym6") {

                            sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym6").play("out");

                         }

                 

                 

                 

                 

                If just techSym1 is being shown on the screen I don't want techSym2 and all the others to be shown going out at all, just techSym1.

                 

                Thank you,

                Kristin

                • 5. Re: Forcing a symbol within a symbol to play out when a button on the main timeline is clicked?
                  resdesign Adobe Community Professional & MVP

                  I am not sure what is going on. Hopefully Sarah or Elaine will respond to this.

                  • 6. Re: Forcing a symbol within a symbol to play out when a button on the main timeline is clicked?
                    elainecc Adobe Employee

                    Hi, Kristin-

                     

                    I'm still a little confused as to what you're asking - can you post your project file for us to take a look at?

                     

                    Thanks,

                     

                    -Elaine