Starling Timer

author:
Zach Foley
description:
Same as Flash timer, but works with Starling Juggler
lastupdate:
2014-01-28
compatible:
1.4 - but should work with any.
depend:
none
tag:
timer, juggler, delayedCall, repeat
homepage:
https://gist.github.com/anonymous/11381801
download:
https://gist.github.com/anonymous/11381801/download

Overview

This class is designed to work as much like the flash.utils.Timer class as possible. There is additional parameter, pass in a reference to a Juggler to handle updates.

Add sample source code like this:

var myTimer:StarlingTimer = new StarlingTimer(Starling.juggler, 25, 0);
myTimer.addEventListener(StarlingTimerEvent.TIMER, onTimerUpdate);
myTimer.addEventListener(StarlingTimerEvent.TIMER_COMPLETE, onTimerComplete);
// To start
myTimer.start();
// To stop;
myTimer.stop();
// To reset
myTimer.reset();

Changelog

Source Code

%gist(11381801)%

User Comments

Feel free to edit this part of the page!