Hi,
I have a problem with the following code:
ActionScript Code:
var myTimer:Timer = new Timer(100);
myTimer.addEventListener(TimerEvent.TIMER, correr);
myTimer.start();
function correr(event:TimerEvent):void{
stope.addEventListener(MouseEvent.CLICK, parar);
}
function parar(Event:MouseEvent):void{
myTimer.stop()
rea1.text = (getTimer() + " ms");
}
It's suposed to start a timer that stops when I press the 'stope' button and display that time (after stoped) in the text box 'rea1'. But that doesn't happen and the following text keeps repeating many times when I enter the frame:
Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MyGame_fla::MainTimeline/correr()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
Could someone help me please?
Thanks