# 1180 error and 1161 error

**URL:** https://forum.kirupa.com/t/1180-error-and-1161-error/319762
**Category:** flash
**Created:** [March 3, 2011, 5:29pm UTC](https://forum.kirupa.com/t/1180-error-and-1161-error/319762 "2011-03-03T17:29:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![arnx1990](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@arnx1990](https://forum.kirupa.com/u/arnx1990)
#### Post date: [March 3, 2011, 5:29pm UTC](https://forum.kirupa.com/t/1180-error-and-1161-error/319762/1 "2011-03-03T17:29:22Z")

</div>

hi! im working on this project that would display the level message “level n” on the screen for a few seconds. im using a timer and it worked in the internal script but when i transferred it to an external script the addEventListener function isnt working.

here’s my code:

```auto
package Game{

	import flash.events.*;

	import flash.utils.*;
	
	public class timerClass{
		public var count:Timer = new Timer(2000,1);	
		public var timerFinished:Boolean;
	
		
		public function timerClass(){					
			addEventListener(Event.ENTER_FRAME, startTimer);
			
		}
		
		public function startTimer(evt:Event){
			count.addEventListener(TimerEvent.TIMER, timerStart);
			count.start();
			count.addEventListener(TimerEvent.TIMER_COMPLETE, onFinish);
			if(timerFinished){
				evt.target.parent.gotoAndStop(2);
				
			}
		}
		
		function timerStart(evt:TimerEvent):void{
			trace("timer started");
			timerFinished = false;
		}
		
		function onFinish(evt:TimerEvent):void{
			timerFinished = true;			
			trace("done!!!");
			count.removeEventListener(TimerEvent.TIMER_COMPLETE, onFinish);
		}
		
	}	
	
}

```

the first code would give a 1080 error but if add a “this” or “root” to the addEventListener,this.addEventListener(Event.EnterFrame, startTimer), function it gives a 1061 error.

i also tried using it without the eventListener

```auto
	public class timerClass{
		public var count:Timer = new Timer(2000,1);	
		public var timerFinished:Boolean;
	
		
		public function timerClass(){					
			//addEventListener(Event.ENTER_FRAME, startTimer);
			
		}
		
		public function startTimer(){
			count.addEventListener(TimerEvent.TIMER, timerStart);
			count.start();
			count.addEventListener(TimerEvent.TIMER_COMPLETE, onFinish);
			if(timerFinished){
				
				
			}
		}
		
		function timerStart(evt:TimerEvent):void{
			trace("timer started");
			timerFinished = false;
		}
		
		function onFinish(evt:TimerEvent):void{
			timerFinished = true;			
			trace("done!!!");
                        evt.target.parent.gotoAndStop(2);
			count.removeEventListener(TimerEvent.TIMER_COMPLETE, onFinish);
			
		}
		
	}	
	
}

```

it works! but after the timer has completed and when it is supposed to go to the next frame to start the game… this is fired by the output window

> ReferenceError: Error #1069: Property parent not found on flash.utils.Timer and there is no default value.  
> at Game::timerClass/onFinish()  
> at flash.events::EventDispatcher/dispatchEventFunction()  
> at flash.events::EventDispatcher/dispatchEvent()  
> at flash.utils::Timer/tick()

i would really need your help on this one. ive been stuck because of this dilemma for a while now.

thanks and may God bless you!!!
