# Adding MC's to stage outside document class

**URL:** <https://forum.kirupa.com/t/adding-mcs-to-stage-outside-document-class/309810>\
**Category:** Uncategorized\
**Created:** [May 25, 2010, 10:26am UTC](https://forum.kirupa.com/t/adding-mcs-to-stage-outside-document-class/309810 "2010-05-25T10:26:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rez1n](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@rez1n](https://forum.kirupa.com/u/rez1n)\
**Post date:** [May 25, 2010, 10:26am UTC](https://forum.kirupa.com/t/adding-mcs-to-stage-outside-document-class/309810/1 "2010-05-25T10:26:35Z")

</div>

Im sure this is quite simple but for some reason I cant get it to work, and it does not throw an error so I dont know whats wrong…

In the library of the main swf file a movie called navigation has been exported to class: ‘NavMC’

If i paste the following code into the document class:

```php

   var navMC:NavMC = new NavMC()
   addChild(navMC);
   navMC.graphics.lineStyle(3,0x00ff00);
   navMC.graphics.beginFill(0x0000FF);
   navMC.graphics.drawRect(0,0,100,100);
   navMC.graphics.endFill();
   navMC.x = 100
   navMC.y = 100

```

It works no problems.

However if I paste that code into a class that gets imported by the document class it dosnt work. Both classes extends MovieClip.

Any ideas?
