Posted By

yambal on 01/17/12


Tagged

timer wait


Versions (?)

タイマーのサンプル


 / Published in: ActionScript 3
 

ユーティリティにしたら便利かな

  1. private var _timer:Timer = null;
  2. private function wait(sec:int):void{
  3. stopWaitTimer();
  4. _timer = new Timer(sec * 1000);
  5. _timer.addEventListener(TimerEvent.TIMER, onWaitTimer);
  6. _timer.start();
  7. }
  8.  
  9. private function stopWaitTimer(){
  10. if(_timer ! = null){
  11. _timer.removeEventListener(TimerEvent.TIMER, onWaitTimer);
  12. _timer.stop();
  13. _timer.reset();
  14. _timer = null;
  15. }
  16. }
  17.  
  18. private function onWaitTimer():void{
  19. stopWaitTimer();
  20. /* */
  21. }

Report this snippet  

You need to login to post a comment.