Search code examples
adobe-edge

Edge Animate - How can i access and change a text from a button in different symbols?


I have this:
ELEMENTS:
Stage - symbol_1

   - symbol_2 

So,... i would like to change a text inside symbol_2 from a button on symbol_1, using sym.$("Text").html("NewText"); What's the correct path!?


Solution

  • In the click event of symbol_1 -> button write this:

    var stage = sym.getParentSymbol();
    var sym2 = stage.getSymbol("symbol_2");
    sym2.$("Text").html("NewText");
    

    This code works if both symbol_1 and symbol_2 are children of Stage. Please note that symbol_1 and symbol_2 are the instances names of the symbols, as they appear in the "Elements" panel (not in the symbol library)