This content has been marked as final. Show 4 replies
I am somehow getting the vibes that you can't eval() anything but variables in Actionscript. Pretty lame, eh?
var ctor:Function = Function(eval("Array")); // pointer to the constructor
var arr = new ctor()
You can do this with any class as long as the class is registered.
"mr.eddy" <email@example.com> wrote in message
> I would like to create an object by a name in a string. For example see
> attached code. Now is this possible somehow? Thanks!
> var myObjectConstructor:String = "Array()";
> var myObject = new eval(myObjectName);
This is very educating!