# Timer Help!

**URL:** <https://forum.kirupa.com/t/timer-help/328595>\
**Category:** flash\
**Created:** [May 29, 2012, 11:55am UTC](https://forum.kirupa.com/t/timer-help/328595 "2012-05-29T11:55:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lisa\_cor](https://avatars.discourse-cdn.com/v4/letter/l/ed655f/32.png) [@lisa\_cor](https://forum.kirupa.com/u/lisa_cor)\
**Post date:** [May 29, 2012, 11:55am UTC](https://forum.kirupa.com/t/timer-help/328595/1 "2012-05-29T11:55:58Z")

</div>

[COLOR=#333333]I keep getting this error… don’t know why as I’ve went over the code and no idea where I went wrong[/COLOR]

[COLOR=#333333]1120: Access of undefined property timerEvent.[/COLOR]

[COLOR=#333333]Here is the code I am doing: [/COLOR]  
[COLOR=#333333]function onTick(event:TimerEvent):void [/COLOR]  
[COLOR=#333333]{ [/COLOR]  
[COLOR=#333333]if (circle2\_mc.y \> 0)[/COLOR]  
[COLOR=#333333]myTimer.addEventListener(timerEvent.TIMER, timerListener);[/COLOR]  
[COLOR=#333333]function timerListener (e:TimerEvent):void{[/COLOR]  
[COLOR=#333333]trace(“Timer is set for 4 seconds because circle has moved!”);[/COLOR]  
[COLOR=#333333]}[/COLOR]  
[COLOR=#333333]myTimer.start();[/COLOR]

[COLOR=#333333]if (circle2.hitTestObject(hit) && potionInPlace == false ){[/COLOR]  
[COLOR=#333333]potionInPlace = true;[/COLOR]  
[COLOR=#333333]trace(“The circle is in place!”);[/COLOR]  
[COLOR=#333333]myTimer.stop();[/COLOR]  
[COLOR=#333333]//stop timer as object is in place[/COLOR]  
[COLOR=#333333]mySound1.load(new URLRequest(“madhatter\_pass.mp3”));[/COLOR]  
[COLOR=#333333]mySound1.play();[/COLOR]  
[COLOR=#333333]//play the audio[/COLOR]  
[COLOR=#333333]}[/COLOR]

[COLOR=#333333]else{[/COLOR]  
[COLOR=#333333]trace(“Didn’t Hit Target and Time is up”);[/COLOR]  
[COLOR=#333333]mySound2.load(new URLRequest(“madhatter\_fail.mp3”));[/COLOR]  
[COLOR=#333333]mySound2.play();[/COLOR]

[COLOR=#333333]}[/COLOR]
