Would it make sense to add a callLater function to starling sprite? I see a lot of different code bases that use Timer, only once, when in fact they are waiting for a view to finish loading or some other operation that doesn't have a "onComplete" event, before executing additional operations within said component.
if its global then it could use an onEnterframe or can be overriden, wouldn't it be more efficient?
spriteinstance.callLater(function,param,1300); //to call out in 1300 milliseconds
starling.sprite:
protected function callLater(method:Function,value:_,delay:int=600):void{//set delay to 600
Sprite.REGISTER_TIME(method,value,delay)
}
private static var registeredCalls:Vector.
private static function REGISTERTIME(method:Function,value:,delay:int=600):void{
var timeNow:int=new Date().getTime();
registeredCalls.push(new Call(method,value,delay,timeNow/timethen/));
}
Would it make sense to add a callLater function to starling sprite? I see a lot of different code bases that use Timer, only once, when in fact they are waiting for a view to finish loading or some other operation that doesn't have a "onComplete" event, before executing additional operations within said component. if its global then it could use an onEnterframe or can be overriden, wouldn't it be more efficient? spriteinstance.callLater(function,param,1300); //to call out in 1300 milliseconds
starling.sprite: protected function callLater(method:Function,value:_,delay:int=600):void{//set delay to 600 Sprite.REGISTER_TIME(method,value,delay) } private static var registeredCalls:Vector.
private static function REGISTERTIME(method:Function,value:,delay:int=600):void{
var timeNow:int=new Date().getTime();
registeredCalls.push(new Call(method,value,delay,timeNow/timethen/));
}
onEnterFrame{ var tot:int = registeredCalls.length; for (var i:int=0; i<tot;++i){ if (Callitem.timenow-callitem.timethen>=delay){ callitem.method(value) registeredCalls.splice(i,1);
--i;--tot; } } } } http://www.computus.org/journal/building-an-accurate-timekeeper-in-as3-iii/?doing_wp_cron=1409956702.9709379673004150390625