How to retrieve a variable nested within a symbol?

Problem: How to retrieve a variable nested within a symbol?

I’m running away from Adobe Animate, and in that program I was able to retrieve variables declared inside multiple symbol instances nested in another by doing something like this:

for (i=1; i<=4; i++){
console.log (exportRoot.mySymbol[‘f’+i].myVar);
};

Reading the forums and chatting with Google’s AI I’ve found this similar solution for Saola

for (i=1; i<=4; i++){
var targetSymDoc = AtomiSaola.topDocs[0].getElement(“mySymbol”).getSymbolDoc().getElement(‘f’+i);

targetSymDoc.setProperty(‘rotateZ’, 90); // This… I just made to check if I was targeting the symbols correctly by rotating them, and yes, it does rotate each of the four symbols

//ALL of this console logs return undefined… why? how can I retrieve the value? each symbols has a function at the very first frame with this.suma = 1;

console.log(targetSymDoc.suma);
console.log(targetSymDoc.getDoc().suma);
console.log(targetSymDoc.getSymbolDoc().suma);

};

Saola Animate version: 3.1.4

OS: Mac Tahoe 26.2

Notes:

Ok… Nevermind… I’m starting to like Google’s AI Mode, seems, like using .this alone won’t work in Saola because “This is a classic scoping issue in Saola Animate. The confusion stems from the fact that this inside a symbol function and the targetSymDoc object are not always pointing to the exact same place for variable storage.”

So, I need to declare my variable inside the symbol as: this.getDoc().suma = 1;

Now everything seems to work. Declarations, functions and console logs both inside and outside the symbols are working.

2 Likes