To create truly global variable in Edge animated, define in a symbol (usually inside the Stage.compositionReady event handler, a good place for global stuff) :
sym.globalFunction = function(){
// statements
}
To call this function from another symbol :
sym.getComposition().getStage().globalFunction();
Here the variable holds a function, but it could hold a number, string, etc.
Nested Objects:
This is great when the object is on the stage. But what if it is in a symbol? Or nested inside a nested symbol. When I took the rectangle and ellipse I had created and placed them inside a symbol, the code immediately broke. Do you know why?
Thanks,
Roger
I tried
sym.rectMouseIn = function(){
// statements
sym.getComposition().getStage().getSymbol(“Symbol_1”).getSymbol(“Ellipse”).fadeTo(0,0);
sym.getComposition().getStage().getSymbol(“Symbol_1”).getSymbol(“Rectangle”).fadeTo(0,1);
}
But it does not work.
Dear Roger,
Sorry for the late delay,
if you want to manipulate DOM nested elements, you have to get the symbol element : sym.getComposition().getStage().getSymbol(“Symbol_1″).getSymbol(“Ellipse”).getSymbolElement().fadeTo(0,0);
Hi, I’d like to reference a class, so 4 symbols will play in tandem. But it will not work. Is it impossible to play a class? I see/think of no reason…
Menu button – nested in a symbol
4 different symbols – given class “indef”
In compositionReady:
sym.playIndef = function() {
sym.getSymbol(“.indef”).play(“article”);
}
Or another problematic application of class. Only one of the four plays.
Also in compostionReady:
sym.flipPersonals = function() {
sym.getSymbol(“.personals”).play();
}
Code on the menu button1:
sym.playIndef();
On the menu button2:
sym.flipPersonals();
Any help for me? Thanks Creative Coder!
Dear Grace,
You can select Edge Animate symbols with a class using :
jquery sym.$(“.indef”) and not sym.getSymbol(“.indef”)
but you won’t be able to target their timeline, it won’t work :
sym.$(“.indef”).play(‘article’); // not working
sym.$(“.indef”).css(‘opacity’, .5); // works because it’s a jquery method
You have to think symbol’s instance name as id more than class
Hi, thanks for the help this site gives.
I have a question, how I can call a funtion from a button in the stage?
The function is in the composition ready panel
function ej() {
sym.getSymbol(“cr1”).play();
}
What code I must put in the button at stage to call this function?
Thanks for your valuable support.
Hi odinx07,
I would link your function to the global window object, so I would write :
window.ej = ej;
Then in your button you could call window.ej();