Removing event listeners in Actionscript

var timer:Timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
function onTimer(evt:TimerEvent):void {
watch.hand.rotation +=5;
if (watch.hand.rotation >= 25) {
timer.removeEventListener(TimerEvent.
TIMER, onTimer);
}
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.