# Accessing Instances within a MC

**URL:** <https://forum.kirupa.com/t/accessing-instances-within-a-mc/298861>\
**Category:** flash\
**Created:** [October 26, 2009, 2:57pm UTC](https://forum.kirupa.com/t/accessing-instances-within-a-mc/298861 "2009-10-26T14:57:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jik\_ff](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jik\_ff](https://forum.kirupa.com/u/jik_ff)\
**Post date:** [October 26, 2009, 2:57pm UTC](https://forum.kirupa.com/t/accessing-instances-within-a-mc/298861/1 "2009-10-26T14:57:57Z")

</div>

Not sure where the difference lies here, but I am trying to understand it. In this piece of code that is a public function of a MC with instances of other MCs in it, I cannot seem to access the instances except in a function within the public function (confused? so am I but here’s the code):

```auto
  public function TitleFlight(stageX=800, stageY=800):void{
   var dTimer1:Timer = new Timer(5);
   x = -600;      
   y = stageY + 600;
   gotoAndStop(100);
   [COLOR=red]head.teeth.gotoAndStop(5);[/COLOR]
   scaleX = 2.5;
   scaleY = 2.5;
   dTimer1.start();
   dTimer1.addEventListener(TimerEvent.TIMER, SpinDude);
   function SpinDude(e:TimerEvent):void{
    rotation += 1;
    [COLOR=lime]head.teeth.gotoAndStop(5);[/COLOR]
    armL.rotation += Math.random()*2 + 1;
    armR.rotation += Math.random()*2 + 1;
   }
  }

```

[COLOR=black]the line in green works fine (like the rotation calls below it), but if I try the same thing (as above in the red font) out side of the SpinDude function, I get this error:[/COLOR]

```auto
TypeError: Error #1009: Cannot access a property or method of a null object reference.
 at Actors::TheDude/TitleFlight()
 at Main/::TitlePage()
 at Main$iinit()

```

Can anyone tell me why?
