# getDefinitionByName() gives error 1065

**URL:** <https://forum.kirupa.com/t/getdefinitionbyname-gives-error-1065/275000>\
**Category:** flash\
**Created:** [November 7, 2008, 4:25pm UTC](https://forum.kirupa.com/t/getdefinitionbyname-gives-error-1065/275000 "2008-11-07T16:25:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nate403](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@nate403](https://forum.kirupa.com/u/nate403)\
**Post date:** [November 7, 2008, 4:25pm UTC](https://forum.kirupa.com/t/getdefinitionbyname-gives-error-1065/275000/1 "2008-11-07T16:25:27Z")

</div>

In my FLA I have a movieclip in the Library named “ContentPanel1”. I have it’s Linkage properties to export on first frame - class “ContentPanel1” and base class flash.display.MovieClip.

In my code I’m trying to attach an instance of this movieclip:

```auto
var instanceClass:Class = getDefinitionByName("ContentPanel1") as Class;

```

Now, here’s the error I get:

```auto
ReferenceError: Error #1065: Variable ContentPanel1 is not defined.
    at global/flash.utils::getDefinitionByName()

```

The weird thing is that this DID work, but when I went into Publish Settings \> Actionscript Settings and then unchecked the “Automatically Declare Stage Instances” checkbox, now it doesn’t work.

Do stage instances need to be automatically declared now in order for this to work?

Nate
