How to allow function to complete if delayed?
If I want a function with a delay, such as a timer or a Loader, to complete before continuing after delay.
For example:
var i:int = new int();
var tim:Timer = new Timer(1000);
tim.addEventListener(TimerEvent.TIMER, goTim);
thisfun();
trace(i);
function thisfun():int{
tim.start();
return (i);
} // function thisfun
function goTim(event:TimerEvent):void{
i = i+1;
}
// returns 0 instead of 1
