ࡱ> Root Entryp|YrRASHContents Page 1  $&)*Root Entryp|YrRASH0ڂContents' Page 1'  !"#%(+,-./012CPicPage CPicLayer CPicFrame?):/* Made by fry at friedcellcollective dot net Use and distribute this freely. Just include this comment block. Version 1.0 new Timer:public usage new Timer(global,[split1, split2,...,splitn]) parameters global If set to true the time is retrieved from Date object, if false from getTimer() split1, split2,...,splitn Optional parameters that define how the tiCPicPage CPicLayer CPicFrame?)\/* Made by fry at friedcellcollective dot net Use and distribute this freely. Just include this comment block. Version 1.0 new Timer:public usage new Timer(global,[split1, split2,...,splitn]) parameters global If set to true the time is retrieved from Date object, if false from getTimer() split1, split2,...,splitn Optional parameters that define how the time is split (default is 1000,60,60,24) returns A reference to the newly created Timer object description Constructor; creates a new Timer object example myTimerObject = new Timer(); myTimerObject = new Timer(1000); // split only into milliseconds and seconds Timer._getTime:private Timer.setStart:public usage myTimerObject.setStart(startTime) parameters startTime Start time in milliseconds returns A millisecond value defining the start time of the timer (derived from getTimer() if global is false and from Date object if global is true). description Method; sets the start time of the timer to the specified value. example myTimerObject = new Timer(true); // global myTimerObject.setStart(new Date(2004,0,0)); // start time is set to the start of year 2004 myTimerObject = new Timer(); myTimerObject.setStart(1000); // start time is set to one second after the flash player started Timer.setSplit:public usage myTimerObject.setSplit([split1, split2,...,splitn]) parameters split1, split2,...,splitn Optional parameters that define how the time is split. If not specified no split will be made (returned time will be in milliseconds). returns An array of the time passed from the start of the timer split by the new split array. description Method; sets the array that defines how the passed time is split. example myTimerObject = new Timer(1000,60); equals myTimerObject = new Timer(); myTimerObject.setSplit(1000,60); Timer.restart:public usage myTimerObject.restart() parameters none. returns A millisecond value defining the start time of the timer. description Action; restarts the timer. example myTimerObject = new Timer(); ... myTimerObject.restart(); Timer.getSplit:public usage myTimerObject.getSplit() parameters none. returns An array of the time passed from the start of the timer split by the internal split array. description Method; calculates the time spent between now and the start of the timer and splits it. example myTimerObject = new Timer(); ... splitTime = myTimerObject.getSplit(); */ _global.Timer = function(global) { this.global = global; this.startTime = this._getTime(); this.splitInto = (arguments.length<=1)? [1000,60,60,24] : arguments.splice(0,1); } Timer.prototype._getTime = function() { if (this.global) { var d = new Date(); return d.valueOf(); } else return getTimer(); } Timer.prototype.setStart = function(startTime) { this.startTime = startTime; return this.startTime; } Timer.prototype.setSplit = function() { this.splitInto = arguments; return this.getSplit(); } Timer.prototype.restart = function() { return this.setStart(this._getTime()); } Timer.prototype.getSplit = function() { var splitInto = (arguments.length==0)? this.splitInto : arguments; return Math.split(this._getTime()-this.startTime,splitInto); } ASSetPropFlags(_global,"Timer",3); ASSetPropFlags(_global.Timer.prototype,"_getTime,setStart,setSplit,restart,getSplit",3); Math.split = function(n,a) { var r = new Array(); for (var i=0;i