# Custom class importing weird issue

**URL:** https://forum.kirupa.com/t/custom-class-importing-weird-issue/324687
**Category:** flash
**Created:** [September 3, 2011, 5:06am UTC](https://forum.kirupa.com/t/custom-class-importing-weird-issue/324687 "2011-09-03T05:06:53Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sledge\_hammer](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sledge\_hammer](https://forum.kirupa.com/u/sledge_hammer)
#### Post date: [September 3, 2011, 5:06am UTC](https://forum.kirupa.com/t/custom-class-importing-weird-issue/324687/1 "2011-09-03T05:06:53Z")

</div>

A very weird problem is happening in my AS3 code.  
I made a custom class called test, and in the main document class I imported it using “import test”. Also, I set the class path correctly so it should work fine. Now, the problem is, when I instantiate this class to an object, it works fine as long as it is outside the document class constructor, it i try to use it inside the constructor method, it doesnt work!

Example:

```auto
package{
     import flash.display.MovieClip;
     import test;

     public class document extends MovieClip {

           var test_obj:test = new test(); // works fine, no problem here

           public function document(){

                    var test_obj:test = new test(); // error: 1046: Type was not found or was not a compile-time constant: test.

            }

     }
}

```
