■■■精确计时 我们设定了时间为 60 秒,然后通过 setInterval 来定期(每1000milliseconds)触发一个函数 runTimer。 function runTimer 用来计时,当时间到了以后,转去执行 outThere。 function outThere 用来处理时间到了以后的动作,不要忘记 clearInterval(intervalID),停止计时。 var time:Number = 60; var intervalID:Number; intervalID = setInterval(runTimer, 1000); function runTimer() { time--; trace(time); if (time == 0) { outThere(); } } function outThere() { // blah blah blah clearInterval(intervalID); }
■■■找到目前最小的一个可用的深度 Depth(来自国外) 针对 Flash Player 6 的: availTopDepth = function () { var allDepths = []; for (var z in _root) { if (_root[z] instanceof Button _root[z] instanceof MovieClip _root[z] instanceof TextField) { allDepths.push(_root[z].getDepth()); } } if (allDepths.length != 0) { sortAll = function (a, b) { if (ab) {return 1;} else {return 0;}};