AS3 invoking class from linkage by string

Today I was programming a game and I run over a problem, I had to invoke a Class by its string name. It can easly be solved by using a switch like: var className:String = “ClassNameOnTheLibrary1”; var gamePhase:MovieClip; switch(className){ case “ClassNameOnTheLibrary1”: gamePhase = new Phase1(); break; case “ClassNameOnTheLibrary2”: gamePhase = new Phase2(); break; } Now…