[AS2]Flash中的Delay函数.

var cSecPerFrame:Number=0.05;
function Delay(timeDelay:Number,secPerFrame:Number):Void
{   var startTime:Number=getTimer()/1000;;
 var tmpTime:Number=startTime;
 trace(tmpTime);
 while(tmpTime<startTime+timeDelay)
  {
   if((tmpTime+secPerFrame)<(getTimer()/1000))
   { tmpTime=getTimer()/1000;
       trace(tmpTime);
   }
  }
}
Delay(5,cSecPerFrame);
trace("ok");

呵呵,旧汤换新药,Delay是能Delay了,不过,用的是强行占用Flash运行资源,连画面都被一起暂停的说.~~~~

你可能感兴趣的:([AS2]Flash中的Delay函数.)