Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

How to access a variable in compositionReady?

$
0
0

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);

sym.$("Result").html(sym.getVariable("X"));

 

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

compositionReady:

var X = 0;

 

Rectangle.click:

sym.setVariable(X, X + 1);

sym.$("Result").html(sym.getVariable(X));

 

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


Viewing all articles
Browse latest Browse all 9897

Trending Articles