10 Replies Latest reply on Sep 30, 2013 12:17 PM by resdesign

    Multiple Nested Symbol Interaction

    ea2th Level 1

      I have 3 symbols that in certain scenarios need to comunicate to nested symbols within those 3, as well as possibly go to a frame within one of the nested.  All actions are currently on the stage.

       

      STAGE

       

      a_sym

      a1_sym

       

      b_sym

      b1_sym

       

      c_sym

      c1_sym

      frame label

       

      Example: From the STAGE, a_sym, a1_sym (a1_sym is  the button) when pressed should trigger action

      Back to the STAGE, c_sym, c1_sym, stop on frame label

       

       

      hammer.on("tap", function(event) {

                          sym.getSymbol("a_sym").getSymbol("a1_sym");

                });

       

      So the part i'm having dificulty is where and how to place the action for the nested a1_sym to trigger the action to go 

      Back to the STAGE, c_sym, c1_sym, stop on frame label


       



        • 1. Re: Multiple Nested Symbol Interaction
          elainecc Adobe Employee

          Hi, ea2th-

           

          There are two different ways for you to go about it - relative or absolute path.  Relative path looks like this:

           

          sym.getParentSymbol().getSymbol("c_sym").getSymbol("c1_sym").stop("myLabel");

           

          The second way, absolute path, just jumps directly to the Stage and goes down.

           

          sym.getComposition().getStage().getSymbol("c_sym").getSymbol("c1_sym").stop("myLabel");

           

          Thanks,

           

          -Elaine

          1 person found this helpful
          • 2. Re: Multiple Nested Symbol Interaction
            ea2th Level 1

            I understand general pathing from stage.

            The question is how to go from inside the nested symbol, back out to the stage, then down into another symbol

             

            because i know it's not this

            sym.getSymbol("a_sym").getSymbol("a1_sym").sym.getComposition().getStage().getSymbol("c_sy m").getSymbol("c1_sym") .stop("myLabel");

            • 3. Re: Multiple Nested Symbol Interaction
              resdesign Adobe Community Professional & MVP

              You could read my blog here and download the samples: http://www.edgehero.com/articles/scope

               

              Here is how I would do it but maybe Elaine would disagree.

              All you need to do is get back on the stage and then you can use the general path. So this should be enough from your other symbol.

               

              sym.getComposition().getStage().getSymbol("c_sym").getSymbol("c1_sym") .stop("myLabel");

              1 person found this helpful
              • 4. Re: Multiple Nested Symbol Interaction
                ea2th Level 1

                Yes i understand the pathing however,  the question is really addressing when the actions are on the stage and navigating in and out of symbols.

                 

                The action from the stage first needs to know to go inside the symbol to trigger a button's function, then go back out to stage, into the symbol, then down to the label.

                 

                I understand the pathing. it's how to get there from a nested button inside a symbol when the nested button function is found in the actions which again, only exist on the stage.

                • 5. Re: Multiple Nested Symbol Interaction
                  resdesign Adobe Community Professional & MVP

                  Hard to understand exactly what you mean. Is there any other way you could describe it?

                  For example: You have a symbol on the stage with a button inside that has a click event ...

                   

                  Are you asking how to detect an event in a symbol containing a button in order to assign another action to this button?

                  • 6. Re: Multiple Nested Symbol Interaction
                    elainecc Adobe Employee

                    Hi, ea2th-

                     

                    From what I understand of the question, resdesign and I have given you the right answer.  Maybe you could provide a quick sample file and point to where you want something to happen?

                     

                    -Elaine

                    • 7. Re: Multiple Nested Symbol Interaction
                      ea2th Level 1

                      Above what you both are discribing does not make sense to me because how does "a1_btn" know to go  back to the stage after pressed or continue to go down this path?



                      hammer.on("tap", function(event) {


                      sym.getSymbol("a_sym").getSymbol("a1_btn").sym.getComposition().getStage().getSymbol("c_sy m").stop("frame_label");


                      });


                       

                       

                       

                      This is the one i've had working but i can press anywhere and works.

                      But what should only be allowed to be pressed is "a1_btn" to trigger the function.

                       



                      hammer.on("tap", function(event) {


                      sym.getSymbol("a_sym").getSymbol("a1_btn");


                      sym.getComposition().getStage().getSymbol("c_sym").stop("frame_label");

                      });
                      • 8. Re: Multiple Nested Symbol Interaction
                        resdesign Adobe Community Professional & MVP

                        In this line the extra sym is totally wrong.

                        sym.getSymbol("a_sym").getSymbol("a1_btn").sym.getComposition().getSta ge().getSymbol("c_sym").stop("frame_label");

                         

                        Everything is triggered from the stage! So, when you are in a symbol, you can access other symbols or their nexted symbols from the stage by returning to the stage with sym.getComposition().getStage(). This is actually the STAGE.

                         

                        Let's say you have on the stage:

                        symbolA contains symbolB (a button)

                        symbolC contains symbolD which has label1 and label 2.

                         

                        You can access label1 from symbolB with a click event on the button:

                        sym.getComposition().getStage().getSymbol('symbolC').getSymbol('symbolD').stop('label1');

                         

                        or in compositionReady you could use:

                         

                        sym.getSymbol('symbolA').$('symbolB').click(function(){

                             sym.getComposition().getStage().getSymbol('symbolC').getSymbol('symbolD').stop('label1');

                        });

                        symbolB gets access to the stage: sym.getComposition().getStage()

                        symbolB gets access to the other symbol's label: getSymbol('symbolC').getSymbol('symbolD').stop('label1');

                         

                        Anyway, here is a sample to demonstrate this: https://app.box.com/s/dqph10hq67rzur9yu9we

                        1 person found this helpful
                        • 9. Re: Multiple Nested Symbol Interaction
                          ea2th Level 1

                          i figured it out.

                          I just needed to nest the actions inside to call specific functions.

                          • 10. Re: Multiple Nested Symbol Interaction
                            resdesign Adobe Community Professional & MVP

                            Glad you got it!