# getDefinitionByName Problem

**URL:** <https://forum.kirupa.com/t/getdefinitionbyname-problem/242024>\
**Category:** flash\
**Created:** [October 21, 2007, 8:05am UTC](https://forum.kirupa.com/t/getdefinitionbyname-problem/242024 "2007-10-21T08:05:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TastyLamp](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@TastyLamp](https://forum.kirupa.com/u/TastyLamp)\
**Post date:** [October 21, 2007, 8:05am UTC](https://forum.kirupa.com/t/getdefinitionbyname-problem/242024/1 "2007-10-21T08:05:31Z")

</div>

Ok so I have this:

```auto
trace('e.props.weapon =', e.props.weapon);
var wClass:Class = getDefinitionByName(e.props.weapon) as Class;
var w:Object = new wClass();

```

Which outputs this:

```auto
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:

```auto
private static const b92:Beretta92 = null;

```

But all to no avail. Any ideas? 🙂
