views:

52

answers:

1

hi, i am trying te recieve the class with only having the name of the class so example:

var className:String = "TheClass";
var theClass = new className();

is this possible?

+6  A: 

You'll need to use flash.utils.getDefinitionByName for it and supply the full qualified name. Try this:

import flash.utils.getDefinitionByName;

var cls:Class = getDefinitionByName("com.domain.project.TheClass") as Class;
var instance:Object = new cls();
Dave