// // PowerSDK:FLOW Interval Manager // version 1.012 // // Author: ted@powersdk.com // Created: 04/12/03 // // addInterval - Add a new interval to the Interval Manager // Usage: addInterval( name, time[, arguments, scope]) // Example: Interval.addInterval('ted',100,[0,1,2,3,4,5],null) // // removeInterval - Remove a interval from the Interval Manager // Usage: removeInterval( name ) // Example: Interval.removeInterval('ted') // // removeAll - Remove all intervals from the Interval Manager // Usage: removeAll() // Example: Interval.removeAll() // // Interval.{intervalname}.addItem - Add a function to an interval // Usage: Interval.{intervalname}.addItem(name,function[,argumentArray,scope]) // Example: Interval.myInterval.addItem('myfunction',_level0.myfunction ,null ,['donut','fruit'] ) // // Interval.{intervalname}.removeItem - Remove a function from an interval // Usage: Interval.{intervalname}.removeItem(name) // Example: Interval.myInterval.removeItem('myfunction') // // Interval.{intervalname}.removeAll - Remove all functions from an interval // Usage: Interval.{intervalname}.removeAll() // Example: Interval.myInterval.removeAll() // // _global.Interval = {} _global.Interval.addInterval = function(name,time,arg,scope){ if(_global.Interval[name]!=undefined) _global.Interval.removeInterval(name) _global.Interval[name] = function(){ var self, a self = arguments.callee for(a in self){ self[a].func.apply((self[a].scope != undefined )? self[a].scope :(self.scope != undefined )? self.scope: null, (self[a].arg != undefined )? self[a].arg :(self.arg != undefined )? self.arg: null) } } _global.Interval[name].id = setInterval(_global.Interval[name],time) _global.Interval[name].arg = arg _global.Interval[name].scope = scope _global.Interval[name].__proto__ = _global.Interval.item.prototype ASSetPropFlags(_global.Interval[name],"id,arg,scope",1) return _global.Interval[name] } _global.Interval.removeInterval = function(name){ clearInterval(_global.Interval[name].id) delete _global.Interval[name] } _global.Interval.removeAll = function(){ for(var a in _global.Interval){ _global.Interval.removeInterval(a) } } _global.Interval.item = function(){} _global.Interval.item.prototype.__proto__ = Function.prototype _global.Interval.item.prototype.__constructor__ = Function _global.Interval.item.prototype.test = function(){ for(var a in this){ trace(a) } } _global.Interval.item.prototype.removeAll = function(){ for(var a in this){ delete this[a] } } _global.Interval.item.prototype.addItem = function(name,func,arg,scope){ this[name] = {} this[name].func = func if(scope!=undefined) this[name].scope = scope if(arg!=undefined) this[name].arg = arg } _global.Interval.item.prototype.removeItem = function(name){ delete this[name] } ASSetPropFlags(_global,"Interval",6) ASSetPropFlags(_global.Interval,null,7) ASSetPropFlags(_global.Interval.item.prototype,null,1)