6 Replies Latest reply on Aug 5, 2015 8:31 AM by Grant Trotter

    Create global variable, get/set from nested div's action

    Grant Trotter Level 1

      I've been reading lots of posts about this that offer slightly different solutions, but I can't seem to get any of those solutions to work in my context.

       

      Perhaps my difficulty comes from the fact that this div is nested within a symbol and 2 div groups. I'm trying to access within a click action.

      So it goes: Stage > Parent Symbol > div group > div group > The div group with the click action.

       

      I'm creating the variable in a compositionReady action on the Stage. I've tried the following declarations:

      • sym.myVar = 'myVal';
      • sym.setVariable('myVar', 'myVal');
      • setVariable('myVar', 'myVal');
      • var myVar = 'myVal';

      And within the div group's action panel, I've tried the following syntaxes:

      • alert(sym.myVar);
      • alert(sym.getVariable('myVar');
      • alert(getVariable('myVar');
      • alert(sym.$('myVar'));

       

      And I've tried every reasonable combination of items on those two lists.

       

      Anyone know what I'm missing? Any documentation to help me get my head around the principles at work here would be much appreciated!