Bit of a hacky way, but you can try something like this:
var symbolName = "Symbol1";
addChild( eval( "new lib." + symbolName + "()" ));
I tried the eval method and it only seems to work if at least one instance of that MC is already on the stage. Can anyone confirm this please?
After a little more rooting around. I found this tutorial. It shows you how to properly add MC dynamically without the need for the eval hack;
- Create your MC and make sure to add linkage (double click the linkage space next to your MC)
- Call new lib.<MC NAME>();
Nice and simple
you're not using a string so that's an answer to a different question than the op posed.
After a long research on the web I've got the code that works for me. And this is this:
var containter = new createjs.Container();
var num = 1;
var className= "MyClass" + num;
var object = new lib[className]();
Perhaps you should use a less vulgar variable name than "containter".
LOL! Well I'm sorry! anyone can make a mistake... I had the code in spanish but I tried to make an english example