hello… i’m trying to create some code which would create instances of arbitrary classes. for example… i’m making a game which will be hosted on a site, and characters i create over time will eventually be selectable for use in game. but instead of uploading an entirely new game whenever i decide to add a new character, i’d prefer to just update an xml file listing the characters, as well as an swf file for each character class.
so during actual runtime, i’d have to create instances of these characters… but i wouldn’t necesarily know which character class constructor i’d be creating… it would depend on who the user selects.
if it were up to me, i’d be able to decide what class instance i’d like to make from a string variable (taken from xml).
like this maybe…
var classname:String = “CharacterOne()”;
var character:Object = new classname;
…instead of having to write: var character:CharacterOne = new CharacterOne();
any ideas? is there something simple i’m missing? by the way, i am using as3.