1 Reply Latest reply on Oct 13, 2014 5:42 AM by Siva.

    accessing symbols inside of adaptive containers

    kunf

      Hello, thank you for taking the time to read my question.

       

      I found one thread that discusses basically what I am trying to do, but the solutions didn't work for me and it looks like it didn't work for the original poster.  The link to this discussion is:  Re: Symbol accessible inside adaptive container?  I am using the edgecommons script to load either 'layout1080' or 'layout600' into a symbol on the main stage called 'adaptiveContainer' depending on the width of the web browser.  This all works great, and I can control the playhead from within either 'layout1080' or 'layout600' (by using getParentSymbol) but when I try to access it from a button within 'adaptiveContainer' or on the stage, I have no luck with any of the solutions I have tried. 

       

      User elainfinnel had what looked to be a good solution, but after trying it I can't get it to work.  Their suggestion was:

       

      In the symbol definition, add a creationComplete event and add the following line:

      sym.getParentSymbol().setVariable("currentSymbol", sym);

       

      Then, in your Stage, you can access the symbol by doing this:

      var mySymbol = sym.getSymbol("currentSymbol");

       

      You can then refer to it as a symbol:

      mySymbol.play("myLabel");

       

      This seemed like a great solution to the problem I am having, but I can't seem to get it to work.  When I inspect the element in firefox I can see the div class for 'adaptiveContainer' (div id="Stage_adaptiveContainer") but the div id for either 'layout1080' or 'layout600' doesn't show.  The div id displays as a number (i.e. div id="Stage_##") that is generated at some point during the script.  I am up to 53 now, and it changes every now and then.  There doesn't seem to be any sign of the div id for 'layout1080' anywhere. 

       

      Thanks for reading and any help is greatly appreciated!

        • 1. Re: accessing symbols inside of adaptive containers
          Siva. Level 3

          It needs a little modification

           

          //In the symbol definition of layout1200,layout800, add a creationComplete event and add the following line:

          var parent = sym.getParentSymbol().getParentSymbol();

          parent.setVariable("currentSymbol", sym);

           

          //Then, in your Stage, you can access the symbol by doing this:

          var mySymbol = sym.getVariable("currentSymbol");

          mySymbol.play("myLabel");