Adding MC's to stage outside document class

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:


   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?