4 Replies Latest reply on Aug 19, 2013 11:05 AM by elainecc

    How to access a variable in compositionReady?

    rfikes4 Level 1

      On my compositionReady I have


      sym.setVariable("X", 0);


      On the stage a Rectangle and a textfield called Result. For the .click on the Rectangle I have


      sym.setVariable("X", "X" + 1);



      What I want to happen is to add 1 to X everytime I click the Rectangle and print the result. But this method only prints out X1 each time I click the Rectangle.


      So what I thought was because "X" is a string I should use X instead but this doesn't work. Nor using this will work


      var X = 0;



      sym.setVariable(X, X + 1);



      What is the correct way to approach this? I also don't have any luck with sym.getComposition().getStage().getVariable(X);