# I give up... Null object error

**URL:** <https://forum.kirupa.com/t/i-give-up-null-object-error/329400>\
**Category:** flash\
**Created:** [August 23, 2012, 2:48am UTC](https://forum.kirupa.com/t/i-give-up-null-object-error/329400 "2012-08-23T02:48:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IgiveUp](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@IgiveUp](https://forum.kirupa.com/u/IgiveUp)\
**Post date:** [August 23, 2012, 2:48am UTC](https://forum.kirupa.com/t/i-give-up-null-object-error/329400/1 "2012-08-23T02:48:06Z")

</div>

Fairly simple. I have an instance of a movieclip (facial expressions) on every frame. 10 keyframes. On each frame I named the instance ‘myFace’. myFace has 3 keyframes. Why would this throw an error saying ‘myFace’ does not exist?

Basically every 8 seconds the facial expression changes to a random one.

```auto

import flash.utils.*;
import flash.display.*;
import flash.events.*;

var rn:int = 1
var myChar:MovieClip = new MyChar();
addChild(myChar);
myChar.x = 287;
myChar.y = 305;

addEventListener(Event.ENTER_FRAME, loop);
var t1:Timer = new Timer(8000,50);
t1.addEventListener(TimerEvent.TIMER, tf1);
t1.start();

function tf1(e:TimerEvent):void
{
	rn = (Math.floor(Math.random() * (3 - 1 + 1)) + 1);
	trace(rn);
}
function loop(e:Event):void
{
	myChar.myFace.gotoAndStop(rn); //<- null object ref error
}

```
