Copy link to clipboard
Copied
The current way to add a library symbol through code is through writing
var test = new lib.librarysymbolname();
this.addChild(test);
or just
this.addChild(new lib.librarysymbolname());
But suppose i have an XML file with a list of the library symbols names
How do i dynamically create the symbols after getting the names?
As you've noted, dot notation doesn't allow use of variables. Bracket notation, however, does.
Property accessors - JavaScript | MDN
var test = new lib[variableName]();
Copy link to clipboard
Copied
As you've noted, dot notation doesn't allow use of variables. Bracket notation, however, does.
Property accessors - JavaScript | MDN
var test = new lib[variableName]();