1 Reply Latest reply on Oct 23, 2012 9:55 AM by TimJaramillo

    How to reference a Stage Function?

    pyratej

      Ahoy, I have a function in the document.compositionReady event of the root stage. I'd like to call a function and possibly change a variable from a symbol deep inside the composition. I've tried going the route of "sym.getParent()" and "sym.getComposition()" but I can't figure out what "symbol" to "get". Any thoughts?

       

      Thanks,

      CapnJ

        • 1. Re: How to reference a Stage Function?
          TimJaramillo Level 4

          Hey pyratej,

           

          You need to climb up the display hierarchy to get the stage scope, then call the function. So from a deeply nested symbol, you can call a stage function, like this:

           

          // function on Stage.compositionReady

          sym.yourFunction = function() {

          console.log('yourFunction');

          }

           

           

          // called from deeply nested symbol

          sym.getComposition().getStage().yourFunction();