Ok so I have this:
trace('e.props.weapon =', e.props.weapon);
var wClass:Class = getDefinitionByName(e.props.weapon) as Class;
var w:Object = new wClass();
Which outputs this:
e.props.weapon = Beretta92
ReferenceError: Error #1065: Variable Beretta92 is not defined.
at global/flash.utils::getDefinitionByName()
at objects.pickups::WeaponPickup/::propsHandler()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at objects::WorldObject/loadProps()
at world::World/loadData()
at world::World/::xmlLoadComplete()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
Beretta92 is a class, it does exist. And I even tried making a reference to it to make sure it is exported:
private static const b92:Beretta92 = null;
But all to no avail. Any ideas?