# getDefinitionByName Seemingly Not Working

**URL:** <https://forum.kirupa.com/t/getdefinitionbyname-seemingly-not-working/230668>\
**Category:** flash\
**Created:** [June 28, 2007, 3:37am UTC](https://forum.kirupa.com/t/getdefinitionbyname-seemingly-not-working/230668 "2007-06-28T03:37:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![McGuffin](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mcguffin/32/408_2.png) [@McGuffin](https://forum.kirupa.com/u/McGuffin)\
**Post date:** [June 28, 2007, 3:37am UTC](https://forum.kirupa.com/t/getdefinitionbyname-seemingly-not-working/230668/1 "2007-06-28T03:37:42Z")

</div>

Alright, weird issue here, out of nowhere basically. Trying to instantiate a class using a string, which works absolutely fine outside of one class (“NavButton”).

```auto

trace(NavButton.work); // traces MOTHER F***ING WORK!
classReference = getDefinitionByName("com.cfms.NavButton") as Class;
// returns ReferenceError: Error #1065: Variable NavButton is not defined.

```

I can manually instantiate the class through new NavButton(). It’s importing fine, it’s compiling fine, I can trace static vars fine, I can manually make the class. All of my other classes from the package work fine with getDefinitionByName…

PS. I’ve stripped everything from the class in case of conflicts, or something…

```auto

package com.cfms {
	import com.cfms.SiteSprite;
	class NavButton extends SiteSprite {
		public static var work:String = "MOTHER F***ING WORK!";
		function NavButton(xmlInfo:XML) {
			super(xmlInfo);		
		}
	}
}

```

ARGH! What am I missing here?
