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

StackOverflow https://stackoverflow.com/questions/18702726

  •  28-06-2022
  •  | 
  •  

Вопрос

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!?

Это было полезно?

Решение

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)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top